Home > Back-end >  How to make projectile travel with a curve trajectory to a targeted position in 3D
How to make projectile travel with a curve trajectory to a targeted position in 3D

Time:08-05

So I want to have my projectiles travel to a targeted position with in a certain amount of time and have a curve trajectory with a max height. I have watchh a couple youtube tutorials but they're just simply not want I need right now is there a way for me to do this ?

I followed this tutorial as first but I can't increase the speed and reduce the time and the height to my liking: enter image description here

The question says

have a curve trajectory with a max height.

Theoretically, the maximum height is achieved when the angle of projection is 90 degrees with respect to the ground and the cosine of 90 is 0. Substituting the value of cos(theta) in the resultant equation results in the value of velocity being infinity, which is practically impossible.

Hence, with the given range and time of flight, two variables, the velocity, and angle of projection can be configured. If the maximum height that you want to achieve is specified, the angle of projection is calculated accordingly.

CodePudding user response:

Unity Slerp will be a good fit for you. You can specify the start, end point and also control the time. You won't be able to control the height as its dependent on the Vectors.

Here is the Link to Unity Docs https://docs.unity3d.com/ScriptReference/Vector3.Slerp.html

  • Related