3d parabola (projectile motion) to hit a target on an arbitrary plane

Join the discussion
Registration is free. Start your own thread to ask a follow-up.
34 replies · 12K views
Ok, I'm just going through your explicit calculation but I noticed I misunderstood you at the start concering the coordinates.
My projectile goes from (0,0,0) to (xt,0,zt)
Yours goes from (x1,y1,z1) to (x2,y2,z2) and after your redefinition (0, 0,0) to (xp, yt,0).
 
Physics news on Phys.org
betel said:
Ok, I'm just going through your explicit calculation but I noticed I misunderstood you at the start concering the coordinates.
My projectile goes from (0,0,0) to (xt,0,zt)
Yours goes from (x1,y1,z1) to (x2,y2,z2) and after your redefinition (0, 0,0) to (xp, yt,0).

well actually i think is more something like

(x1,y1) to (xp, yp) where yp = yt anyway, is xp that changes as a "proportion" of x2 and z2

to have everything in a way that works in 3D
 
My idea was wrong. Easy to check in the even leveled case.

Yours seems to be correct though. Just solve the quadratic for v^2 and then do the square root again and you get.

[tex]v= \sqrt{g(y_p-y_0+\sqrt{(y_0-y_p)^2+x_p^2})}[/tex]

You would have really made your life much more easy if you had chosen (0,0,0) as the start and zt=0. It is much faster to later transform the coordinate system.
 
Last edited:
Arioch82 said:
Hi Petr and thank you for your reply.

unfortunately I've already tried that one and it doesn't give me the desired result.

If you see the new screenshot attached to this post you can notice that in that way (well I'm using quaternions instead of a matrix but it should be the same) the all parabola rotates around the axis while a need the start (point with the axis displayed) and the goal (green sphere at the end of the cyan line) to be fixed so that i can launch my projectile from my start point to hit a specific target as like an "effect/curl" is applied to the parabola.

in the screenshot I'm applying a rotation around the cyan axis, I've also tried around the magenta one (direction on the XZ plane) with similar result.
The first red segment from the start point to the start of the parabola is displayed only because I'm assuming that the start point is always the first point (t=0)

Ok, so you want to rotate the parabola taking initial and final points fixed. This should be the solution:

1) the direction of the rotation must be the one connecting the initial and final points:

[tex]\mathbf{n}=\frac{\mathbf{x}_f-\mathbf{x}_i}{|\mathbf{x}_f-\mathbf{x}_i|}[/tex]

2) use this n and the angle you want, to construct the rotation R, like I said in my previous post, or with quaternions if you like.

3) Don't just do a linear rotation

[tex]\mathbf{x}'=R\mathbf{x}[/tex]

but do instead an affine rotation

[tex]\mathbf{x}'=\mathbf{x}_i+R(\mathbf{x}-\mathbf{x}_i)[/tex]

EDIT: oops I saw too late that the thread went on for 3 pages, and that the solution was already there...
 
betel said:
My idea was wrong. Easy to check in the even leveled case.

Yours seems to be correct though. Just solve the quadratic for v^2 and then do the square root again and you get.

[tex]v= \sqrt{g(y_p-y_0+\sqrt{(y_0-y_p)^2+x_p^2})}[/tex]

You would have really made your life much more easy if you had chosen (0,0,0) as the start and zt=0. It is much faster to later transform the coordinate system.

Thank you betel, that works perfectly, I know that with (0,0,0) my life would be much easier but know I've got a general system to target a point from everywhere.

Thanks to Petr too!

I've also found out that my quaternion wasn't working because I wasn't applying an affine rotation but a linear one.
Using the affine it works great with quaternions too (as it should obviously be) :)

Thank you guys for your help, really, everything works just fine now!
 
Last edited: