Jump to content
  • Advertisement
Sign in to follow this  
tgn376j

Position between to points.

This topic is 4946 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Subject: 2d project. Particle flow between two points. Little fact: Particles about 200, and each has int X, int Y and int Z for speed. Now for the question: If you want the straight way between two point you use Y1+Y2/X1+X2 (im a right?). But because the particles might be more then 200 in the future I want the program to just calculate the movement once and then move it after the values. Follow me? I want the program to calc that if PosA 100,100 and PosB 200,200 it should move every particle one right and one down. Has anybody got a smart solution.

Share this post


Link to post
Share on other sites
Advertisement
Interpolation:
p = (1 - t) * u + t * f, as t varies from 0 to 1. u is initial position, f is final position, p is current position.

Share this post


Link to post
Share on other sites
Not sure I understand it but I was thinking more along the line of just calc how much to move to the side if moving one up or one down. (In other words im stupid in dont know what you saying. :D)

Share this post


Link to post
Share on other sites
Olusey has given you a way to set the position at any interval from point a to point b. I think you are looking for a way to precalculate the offset between steps

distance = point b - point a;
step_offset = distance / num_steps; // precalculated does not matter to use div

That should do the trick.

Share this post


Link to post
Share on other sites
Yes he had the most exact way were you can get the values anywere, but all I need is the fast way. So thank you both for the help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!