Jump to content
  • Advertisement
Sign in to follow this  
amak

Sliding on the walls - problems

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

Hi. I'm trying to implement sliding but i'm desperate. I'm using the document Telemachos (http://www.peroxyde.dk). In document says that i need to calculate the newPosition so for the newPosition i'm doing this: colPackage->newPosition = colPackage->basePoint + colPackage->velocity * t; where t is the time when the sphere collides with the wall in the elipsoide space. To see if this is correct i put the camera position with newPosition but he goes through the wall. Anyone implemented sliding easily? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
The basic concept here is to take the point where the object "wants" to move, and project a ray from that point along the normal of the surface it collided with. The intersection of this ray with the collision surface is the exact point where your object would slide in a frictionless environment. Adding friction is trivial.

EDIT: taken from http://www.gamedev.net/reference/articles/article1026.asp



Good luck [grin]

Share this post


Link to post
Share on other sites
A more realistic way to handle collision response is to take the collision normal (newCirclePoint - Contactpoint) and use it to reflect the velocity vector. If you only want sliding, then you set the coefficient of restitution to 0. Sliding is just a simplified case.

Read about it.

Share this post


Link to post
Share on other sites
I don't know if this might be of use as part of it does discuss and give a formula for sliding along walls!

BSP Collision Detection as used in MDK2

Personally, I don't reflect the players direction, but in my game it suits me to simply invert the players velocity and move it a small distance away from the wall, but then my character has inertia which suits this kind of collision response, in my case it looks and works beautifully, but if not using inertia, then a sliding system would be better.

Anyhoo, hope the article helps!

Steve

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!