Physics trajectory

Look

I have this problem

I need to throw an object (rigidbody) so that it falls in an specific point on a terrain.

  • The point is obtained by clicking with the mouse onto the terrain and raycasting.
  • The origin is obtained from the position of the unit throwing the object.
  • The initial velocity of the throw is a property of the unit.

So now i need an angle to ensure that the object will fall in that point giving that initial velocity and the physics gravity.

I cannot animate that trajectory since the object can be blocked on the way by other objects, or the terrain itself, so i need physics acting over the object.

I used this formula with no luck, can someone tell if it should work with Unity’s physics engine ??

Thanks in advance

.ORG

I have had most luck simulating trajectories by basically using a raycast projectile script, except inside a while loop instead of in update, so it moves all at once. Make sure your while loop has an end if it doesn’t hit anything!