Hi guys, I'm working on a 3D Pinball Table and everything was working just fine (physics, table, bumpers, flippers, etc) until I got stuck at the slingshot. What I want to do is: as near as the ball hit on the middle of the slingshot, more force will be added to the ball (see image attached). I don't know how to start programming that, nor even where I'll put the code(s) (on the ball or on the slingshot itself ?). I've already tried some stuff, but in vain. Does anyone have any idea on how to do that? If yes, please, explain in a simple way (and if you'll give examples, please use C#). Well, that's it. Thanks.
Depends on how your ball-object collisions are being handled When you detect a collision happens somewhere along the bouncy surface, you can then calculate how far along the line it happened (inverse lerp), then scale the added force depedant on that (more force at 0.5 - middle, less force towards 1 or 0 ends)
Attach AnimationCurve to Collider, and evaluate bounce considering the impact position and Collider rotation(forward).