Game Development Community

Help with annoying planes (the math kind)

by Josh Albrecht · in Torque Game Engine · 09/08/2001 (12:36 pm) · 3 replies

Here is what is going on:

1. I set the dimensions of my bounded plane and my intersecting line. THe line is set so that it will go right through the middle of the plane)
(this works)

2. I multiply all the points for the plane and line by the transform I need.
(this works)

3. I draw the bounded plane by connecting all four dots (I am just making a rectangle) and I draw the line. Everything looks perfect; the line goes right through the plane.
(this works)

4. I create a real Plane3F with this code:

plane.set(corner1, corner2, corner3);

(I dont know if this works)

5. I use this code to do the intersection. It returns the distance from the start point to the plane intersection:

F32 distance = plane.intersect(START, END);

(I dont know if this works)

The distance is always wildly off. So I either set the plane wrong, or did the intersect wrong. Which is it?

(If you need the rest of the code, I can post it, but I think this is better because it is more concise).Thanks for any help guys!

#1
09/08/2001 (3:53 pm)
Don't know much about it, can you tell us if intersection line suppose to be at a normal angle to intersect plane and originating at point START? In that case is your line also drawn at normal angle? Also, I see that 3F plane is defined with 3 corners, which will give you triangle and not your drawn rectangle, and it could be that there is no intersection at all as line goes through middle of rectangle - edge of triangle.
If I got it wrong just ignore this please.
Regards Sasha
#2
09/09/2001 (12:07 am)
The plane.set stuff should work fine if you know what three values you're supposed to put in there

The three points in space define a plane... specifically the unique plane that contains all 3 of the points, the code internals of PlaneF::set() find the center of the three points and then the plane's normal which is what's stored (4 variables rather than 9)

My guess would be your call to intersect isn't returning what you think it should be... I'd be able to better understand if you posted the bits of your code that you think are suspect... what you think they should be returning, and what they actually are returning...
#3
09/09/2001 (9:34 am)
Yeah, I found the problem.

You were right nohbody. The intersect function wasnt returning what I htought it was. It was returning the percent along the line that you had to travel to intersect, not the distance.

I got it, and now my hitboxes should work perfectly. I will start a new thread soon, and detail exactly how to make working hitboxes.