Hey, I have been messing around with trying to launch a projectile over a target. I couldn't figure out how to AddForce at the desired angle which led me to math and code I don't understand. X.X I can AddForce Vector2.up and AddForce Vector2.right but I cannot figure out how to do this?
Classical mechanics gives you all the equations you need for continuous physics: https://en.wikipedia.org/wiki/Classical_mechanics You need to map the fundamentals of your game situation into the classical mechanics equations. If you need help grasping the basic concepts of those elemental inputs (force, mass, inertia, speed, distance, etc.), there are open courseware options such as: https://ocw.mit.edu/courses/physics/8-01sc-classical-mechanics-fall-2016/
What I do with rigidbody ballistic projectiles is this: 1) calculate the firing angle, rotate the 'Turret' gameobject to said rotation. 2) Instantiate the projectile gameobject on the tip of the barrel, I have a particle system on the end called "muzzle" so i use that, you could also do "turret.position + (turret.forward * turret.barrelLength)". (ofcource with the same rotation as the turret) 3) just add local force in positive Z to the projectile, add the same amount of force as you used for the calculation. this link is also helpful: https://en.wikipedia.org/wiki/Projectile_motion I can give you a hand but in 3D if it applies, how are you approaching it?, you've just said "I'm messing with it".. - how?
You can use my solution here: https://stackoverflow.com/questions...th-initial-impulse-in-unity/42794800#42794800
Thanks for responding! This is all really great! I need an education in Classical Mechanics among other things lol. I really appreciate everyone's feedback!
I think @Kurt-Dekker's response was far too complicated and I think perhaps the OP needs to be a bit more specific with their question, if you're talking about a simple arc you could make an arc called a parabola arc and this will do the job in most cases. Are you by any chance looking for something more complicated though? Like being able to make a parabolic arc that calculates for you where a rigidbody might hit?