Sign in to follow this  

Distance to plane 0.3f

This topic is 3486 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 looking for the minimum distance to a plane before collision. right now with my velocity-vector i can only check > 0.3f otherwise in one movement the player will go throught 0.3----><-----0.3f scale and pass through a wall. i know that many of you use the planes normal as the minimum length to the wall but i cant do this because of the way i rayCast on my planes(i need closest point on plane to be exact). if you have two planes in lets say 30 degrees angle, there will be a gap in the corner by pushing out the normal vector so this is not a solution for me. Right now the player runs through the wall because its to fast for 0.3f and this gives me a "hard" first contact with the wall/planes... i want to compare like this: Distance to wall < 0.001f, but these numbers are to small for my velocity... =( Any ideas about how to solve this problem? ive tried to convert to double but this isn´t working...

Share this post


Link to post
Share on other sites
I'm not sure why converting to a double would change anything. Sure, you're going to have more precision but if you're already using .3f as an epsilon it's not going to help much.

I think the simplest solution would be to check states at the beginning and end of your frame. If a unit is on the positive ( or negative ) side of a plane at the beginning of the frame and then at the opposite at the end ( after your velocity update ) then there is a possibility of collision with the wall. You can then do your ray-intersect test to see if your unit's path of travel intersects with the wall.

To do this correctly, you will have to "extend" the wall out, in effect adding your unit's width, height, and length to the wall since the ray is infinitely small. The easiest way to do this is to add the radius of your unit's bounding sphere to the wall and "push" it out.

If that's not clear I can come back and edit this post but, unfortunately, I've got to run to class.

Good luck!

Share this post


Link to post
Share on other sites

This topic is 3486 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this