Jump to content
  • Advertisement
Sign in to follow this  
Meshboy

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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...

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!