Jump to content
  • Advertisement
Sign in to follow this  
Meshboy

Collision response is to slow.

This topic is 3552 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 folks! In my FPS Game i have this tactic for my Collision Response (sliding walls). 1 Find the closest Point on any of my wall. 2 If any of these points is closer than 2 (Radius of my sphere) 3 Push the player out as far as the sphere "overpenetrates" the max distance allowed( in this case 2 as radius) Example: Min Distance to wall is 2. if DistanceToWall < 2 PushPlayer out formula: VPushout = (2-ActualDistanceToWall) * NormalizedNormalVector Of That wall S THIS RIGHT? BECAUSE THE PLAYER CAN COME TO CLOSE THE WALL ANYWAY. My MoveVector that has the speeds and direction that the player is traveling with is added with the Correction Move_v+=(2-ActualDistanceToWall * NormalizedNormalVector Of That wall). It feels like i am missing a step, i have to do some more checks and push the player out sooner. Because when the player slides with full speed i have a distance of 1.2 to the wall. When i Press "W" key the speeds are increasing and when letting go the speed decreases. The formula for my move vector is like this, the only thing i control is the speeds. vector vForward = camera.mview-camera.mpos * forwardspeed The Move_v = vForward + vBackward + vLeft + vRight (and so on) i can´t figure out why this isn´t enought to push the player out to the exact distance of 2 (radius) This formula is just doing the work like 70% or so depending on the speeds. (2-ActualDistanceToWall * NormalizedNormalVector Of That wall) If i just push the player slowly against the wall i endup 1.8 away from wall, but with full speed i end up 1.1f to the wall, so there must be something with the speeds i am missing. Anyone have a formula for pushing the player out with the Wall Normal and the penetrated distance?

Share this post


Link to post
Share on other sites
Advertisement
Problem solved!

I forgot to update length to wall after pushing player out of the wall.

No the player ALWAYS has exactly the distance of my radius to any walls, obtuse or not obtuse!

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!