Sign in to follow this  

Deflection

This topic is 2659 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 its been a while since I was in Calculus and I have since forgotten exactly how I would go about doing this. Say I have the X and Y velocities of the player along with the slope of a line. How do I calculate the X and Y velocities after the player collides with the line and then deflects and "bounces" off of the line?

All I can remember is I know I have to get the normal vector of the line but after that I am not sure what to do.

Thanks! :)

Share this post


Link to post
Share on other sites
That depends on what kind of collision you are looking for. I assume it's an elastic bounce you want, in which case you want to find the reflection vector. It is found using this formula:

v_r = -v_i + 2 * (v_i . n) * n

where v_i is the incoming vector pointing towards the intersection point and n is the surface normal.

Try drawing the model on a piece of paper and you'll see quite easily how this can be deducted.

Share this post


Link to post
Share on other sites

This topic is 2659 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this