Distance to plane 0.3f

Started by
0 comments, last by Peter5897 15 years, 11 months ago
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...
Advertisement
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!

This topic is closed to new replies.

Advertisement