Jump to content
  • Advertisement
Sign in to follow this  

Collision Sliding Problem

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

[DISREGARD] I was doing something wrong so the question is invalid.



Hi guys, I'm in the process of adding sliding to my collision response and in the articles I've read they don't mention something.


Let's say I'm doing a sphere-wall collision, the sphere (player) moves due north and the wall's normal points due south, when the sphere hits there will be no sliding vector since the velocity and normal are complete opposites, that's fine if the guy stops moving, but if he keeps heading directly into the wall I will keep getting collisions at time zero and nothing else will happen. Even if I detect it it will cause problems if the guy keeps heading almost directly into the wall, the sliding vector will be so small that I'll keep getting collisions at such an early time resulting in the same effect.


I'm basically finding the first collision, moving all the objects, then looping until the time in the frame runs out.


Maybe I have it all wrong ?



Edited by Endemoniada

Share this post

Link to post
Share on other sites

There are several different ways of doing all of this. From what I've read it seems to be common to move the objects, detect a collision then solve the intersection by moving it along a vector make the objects not intersect anymore and then apply some force/impulse to make it bounce (if that's what you want, otherwise just move them apart).




The first circle to the left might be where the intersection is detected and the red vector is the direction it has been moving. Then moving it along the normal of the surface (green vector) it would appear sliding along this plane. This might be sufficient for your application.


EDIT: Just realized the image is a bit misleading. The image implies the sphere that is intersecting the plane still is moving along the red vector but my point is that it has moved along its entire vector and should only be moved "up" along the plane's normal. But the red vector is the direction it has already moved (to get to its current position). Sorry, this is perhaps quite confusing. If you have any questions about this, please ask.

Edited by hannesnisula

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!