Jump to content
  • Advertisement
Sign in to follow this  
Guest

vectorial velocity

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

Guest
Let's say I have a ball flying almost parallel with a wall (but will eventualy hit the wall). How can I find out the velocity of the ball on the direction perpendicular to the wall? I think I should break the direction of the ball into the components, but which components? In which system?

Share this post


Link to post
Share on other sites
Advertisement
Scale the wall's normal by the dot product of itself with the ball's velocity - to get the component velocity of the ball in the direction of the wall normal (note that the normal must have length 1 for this to work).

If you just want the speed you can just use the dot product value. Negative means you are moving towards the wall and positive away from it. 0 means you are moving parallel to the wall.

You can get the velocity component parallel to the wall by subtracting the vector you just calculated from the actual velocity.

Share this post


Link to post
Share on other sites
The components you want are those in the wall's local space. In particular, you need one of the axes to be the wall's normal (perpendicular to the wall's surface); it doesn't much matter what the other two (in the plane of the wall) are, generally.

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!