# Corner Slide-correction too fast.

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

## Recommended Posts

i am creating a FPS game. If the player is too close to the wall i push him out with the help of the distance to the wall and the walls normal. but if i consider if the player is facing the wall or not gives jerky sliding at corners. If i include this code:if (planes.FacingWall(move_v)) (move_V is my direction vector) then the sliding is smooth around the corners BUT then the player is let out of the corners if the angle is less than 90 degrees. if i exclude it then everything works rock solid, but when sneaking around the corner at low speed gives you a too big correction, the player is thrown from the wall too fast. Here is my code, any suggestions? float min_distance_to_wall = 1.1f; for (int i=0; i < planes.size(); i++) { D3DXVECTOR3 vLength; D3DXVec3Subtract(&vLength,&planes.ClosestPoint(_camera.mPos),&_camera.mPos); vLength.y = 0; if (D3DXVec3Length(&vLength) < min_distance_to_wall) { float pushOut = min_distance_to_wall - D3DXVec3Length(&vLength); if (planes.FacingWall(move_v)) _camera.MoveCamera((planes.GetNormalVector() * pushOut)); } D3DXVec3Subtract(&vLength,&planes.ClosestPoint(_camera.mPos),&_camera.mPos); vLength.y = 0; }

1. 1
Rutin
18
2. 2
3. 3
JoeJ
12
4. 4
5. 5

• 16
• 18
• 10
• 13
• 17
• ### Forum Statistics

• Total Topics
631694
• Total Posts
3001746
×

## Important Information

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!