# Sliding on the walls - problems

This topic is 4895 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
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 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.

##### 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

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
633715
• Total Posts
3013496
×