This topic is now archived and is closed to further replies.


Particle Motion

Recommended Posts

d9930380    122
I want to be able to fire an object so that it lands exactly at another point in 3D space (when in the air - the only thing that will change the object''s velocity is gravity). What I need to be able to find is the initial velocity that the object must have. However the magnitude of this velocity will be capped, so it''s only the direction that I need to find. Any ideas on how this should be done.

Share this post

Link to post
Share on other sites
VisualB4BigD    122
This is pretty simple. I have the formula for Projectile Motion. All you have to do is rearrange the formula to find Inital Velocity. Then take that value and plug it back into the formula. Good Luck

Horny Farmer (Jolly Rancher)

Share this post

Link to post
Share on other sites
d9930380    122
Thanks for the replies.

The problem is to do that you need to know the time the projectile takes for the complete journey.

I don''t know this, I only know the magnitude of the initial velocity. If someone could tell me how I could use this to get t then I think I could take it from there.

Share this post

Link to post
Share on other sites
powdahound    158
Horizontal movement will only affect the distance. So here's how you do it:

Find the distance between the points (where you're starting and where yuo want to get to). And then find the vertical distance between the points.

You need to have 3 values to find the other two so you have: a = -9.8m/s2 (if you want to simulate earth's gravity). vf (final velocity) = 0m/s. d = whatever you calculated for vertical displacement. You want to find vi (initial velocity) and t (time in seconds).

vf2 = vi2 + 2ad
vi = sqrt(2ad - vf2)
since vf = 0
vi = sqrt(2ad)
so there you go, initial velocity

then for time:
d = vi*t + 0.5at2
(d - vi*t)/(0.5a) = t2
t = sqrt((d - vi*t)/(1/2a))

somebody correct me if i'm wrong. i just got up.

[edited by - powdahound on June 10, 2002 12:31:10 PM]

Share this post

Link to post
Share on other sites
danz    122
ok, i''m gonna just post the results, if you want te entire way, just say so, i''ll be more than glad to post it.

so here is the thing:
we want to move the particle from the point A=(ax,ay,az) to the point B=(bx,by,bz).
we assume that the gravity is towards the nagative side of the z axis, we''ll call it g.
now, the "vertical" distance the particle should pass is : vd=bz-az
now in the motion equation : vd=0.5*g*t*t => t=sqrt(2*vd/g)=sqrt(2*(bz-az)/g)
the "horizontal" distance is : hd=(bx-ax)*sqrt(ax*ax+ay*ay)/ax
in the motion equation : hd=v*t => v=hd/t=((bx-ax)*sqrt(ax*ax+ay*ay))/(ax*sqrt(2*(bz-az)/g))
to get the vector, scale the vector u=(ax/sqrt(ax*ax+ay*ay),ay/(bx-ax)*sqrt(ax*ax+ay*ay)/ax,0) by the resulting v, V=u*v=((sqrt(g)*(bx-ax))/sqrt(2*(bz-az)),(sqrt(g)*(by-ay))/sqrt(2*(bz-az)),0)

that''s it! you can make this shorter if you call bx-ax=dx, by-ay=dy, bz-az=dz
so you get : V=(sqrt(g)*dx/sqrt(2*dz),sqrt(g)*dy/sqrt(2*dz),0)
you may precalculate sqrt(g)/sqrt(2*dz)=dzg, so V=(dzg*dx,dzg*dy,0)

voualla! simple heh?

Share this post

Link to post
Share on other sites
danz    122
as c code:

#define G 9.8


typedef struct{
float x[3];

float getvelocity(vector3f a,vector3f b,vector3f *velocity){
float dx,dy,dz;
float time,invtime;
return time;

Share this post

Link to post
Share on other sites