Jump to content
  • Advertisement
Sign in to follow this  

Calculating new trajectory vector in 2D

This topic is 2116 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

So suppose I have this:

A ball and a paddle.
The ball comes at the paddle with a certain speed,and at some point,the ball will hit the paddle.After that,the ball will be reflected to a new position,I need to calculate that new position vector where the ball will have to go after it hits the paddle.

I already have the equation,but because my math is very bad,I don't really understand it.
Can someone explain every part of it,why it's needed,and how it works? Like why do we use the dot product?

Here it is:

//calculate rebound vector(r) from normalized difference in position(p) and ball's velocity(v),

//and considering forward(f) and paddle velocity(u):
r = p * (1 - dot(p, f) + len(v)) + u

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!