Point1.x = sin(Heading+45);
Point1.y = anything;
Point1.z = cos(Heading+45);
Point2.x = 3*sin(Heading+45);
Point2.y = anything;
Point2.z = 3*cos(Heading+45);
Point3.x = 5*sin(Heading+45);
Point3.y = anything;
Point3.z = 5*cos(Heading+45);
I add 45 to the heading because there is a 90 degree FOV, and this is the right plane. The left plane is the same thing, except I subtract 45. The sines and cosines have coefficients in point 2 and point 3 so that they would be different from each other. The y-values can be anything because a plane would extend to infinity and negative infinity on the y-axis. I'm also not worrying about the points being clockwise, I can go back and change the order. This algorithm doesn't seem to work, does anyone know why? Is there a well-known algorithm that many games use for doing this?
Proceeding on a brutal rampage is the obvious choice.
[edited by - amish1234 on June 14, 2002 12:30:08 PM]
[edited by - amish1234 on June 14, 2002 12:51:44 PM]
finding points within a plane
I need to find 3 points forming a triangle within a given plane. This will be used to find the normal to the player's view frustrum planes. The angle system I'm using is heading, where looking north is 0 degrees, and looking east is 90 degrees. Right now I'm just concerned about the 2 planes on the x/z axes. I'm not dealing with the pitch right now. This is the algorithm I'm currently using:
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
Point1.x = sin(Heading+45);
Point1.y = Camera.y;
Point1.z = cos(Heading+45);
Point2.x = Point1.x;
Point2.y = Camera.y + 1;
Point2.z = Point1.z;
Vector1.x = Point1.x - Camera.x;
Vector1.y = Point1.y - Camera.y;
Vector1.z = Point1.z - Camera.z;
Vector2.x = Point2.x - Point1.x;
Vector2.y = Point2.y - Point1.y;
Vector2.z = Point2.z - Point1.z;
Now find the normal of the right plane.
CrossProduct(Vector1, Vector2);
Go on an Intense Rampage
Point1.y = Camera.y;
Point1.z = cos(Heading+45);
Point2.x = Point1.x;
Point2.y = Camera.y + 1;
Point2.z = Point1.z;
Vector1.x = Point1.x - Camera.x;
Vector1.y = Point1.y - Camera.y;
Vector1.z = Point1.z - Camera.z;
Vector2.x = Point2.x - Point1.x;
Vector2.y = Point2.y - Point1.y;
Vector2.z = Point2.z - Point1.z;
Now find the normal of the right plane.
CrossProduct(Vector1, Vector2);
Go on an Intense Rampage
Go on an Intense Rampage
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement