Sign in to follow this  
TigerSam

Rotating a plane

Recommended Posts

Hi All, Im have a floor in my game which can be rotated about. Seperately i have also defined a plane object which represents the plane the floor is sitting on. I draw and rotate my floor like such:
void SomeDrawMethod()
{
...
glPushMatrix();
glRotate(someValue, 0, 0, 1) // rotate by somevalue around z axis
drawFloor();
glPopMatrix();


}
What i would like to know is how i can rotate the plane to lie on the new position of the floor? My Plane is just a basic objet containing a point and normal
class Plane
{
public:
Plane();
~Plane();

// Some Accessors here

private:
vector4f point;
vector4f normal;
}
If any1 could help me out it would be much apprechiated. Cheers.

Share this post


Link to post
Share on other sites
Quote:
Original post by furby100
Rotate the normal.


Thanks for the reply, That wouldnt work as the floor is being rotated around a centre point, not its own centre. ie imagine the floor at point (0,-2,0) and rotating around the point (0,0,0). This should be a really simple problem but has lost me toatlly, if i can find the new plane point then the normal can be got from that.

Cheers

Share this post


Link to post
Share on other sites
transform both the point and the normal.

If you set the w coordinates correctly (1 for a point, 0 for a vector/normal) then you can apply transformations to your plane in exactly the same way as you would for anything else.

Share this post


Link to post
Share on other sites

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