fbpx

 

Projectile Trajecto...
 

Projectile Trajectory motion on 3D without using of Physics and Transform.Translate, help with formula needed  

   RSS

0

Hello everyone, I'm sorry first of all for my bad english gramma, not my mother tongue. I'm facing a problem refer to the lauch of a gameobject from an arbitrary height toward a target positioned at know distance but with some difference on height too possible, that's with a fixed angle of 55 degree for example. If the problem is on 2D I did some calculation and apply the usual formula from wiki for get the Y and X (or Z in my case) over time with:

Y=Y0+V0y*t+0.5*g*t^2 and X=X0+V0x*t+0.5*a*t^2 and it's working pretty well once I get the starting velocity on Y and X to add every frame

Now what about I have to shoot from let's say a position of (1,2,1) toward a position of (2,8,5) ? If on translation it's easy because you turn and increment as if in 2d space but in 3d how to get the initial velocity on x y and z ? I want to avoid the physics because only for this particular need I have to make the shoot of my gameobject faster then would be using the standard G.

Hope I've been clear enough, best regards

Topic Tags
1 Answer
0

Hello plaguebreath,

You can try targeting the object directly and calculating the 2D path like this

Vector3 directionToTarget = (GameObject.Find("Target").transform.position - transform.position).normalized * speed;

@justice7ca

that will not consider a parabolic trajectory 🙂

Share:

 

 

Scroll to Top

Please Login or Register