# Sliding reflection

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

## Recommended Posts

I am using this for subtracting the speed and get reflection vector so i can slide on the wall in my FPS. This works 100% perfect against the normalized normal of the plane(wall). sphere_velocity -= n * (sphere_velocity.dotProduct(n)); My problem here is that when i loop this on all my planes it gives me jerky sliding in edges and corners. Shouldent the normal in this case be the point from ClosestPoint on plane to camera pos? but this don´t work, then i can go through walls. i think my problem is that i don´t use correct timing procedure and calc each frame. One thing i can think of is that i don´t put the camera on the closestPoint right after collision occurs. What would your advise be to check first for solving this problem?

##### Share on other sites
Solved it! Now my Slide vector is all 3D and the same as in Quake 3 for Clipping Velocity! =) Hurray.

Moment or glory...

void PM_ClipVelocity( D3DXVECTOR3 in, D3DXVECTOR3 normal, float overbounce ) {

float backoff;
float change;
int i;

backoff = D3DXVec3Dot(&in,&normal);

if ( backoff < 0 ) {
backoff *= overbounce;
} else {
backoff /= overbounce;
}

for ( i=0 ; i<3 ; i++ ) {
change = normal * backoff;
velocity = in - change;
}
}

But i still have problems with the camera shaking when hitting edges, and if a corner is narrow enought, i slide right through it. Must calc each frame with times or something i think...

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

• 14
• 14
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631757
• Total Posts
3002135
×