Sign in to follow this  
johnnyBravo

Trying to setup up my view matrix to my spaceship problem (eye,at,up)

Recommended Posts

Hi i'm trying to setup my view matrix to my 3d space ship. eg the eye point, at and up vectors. My spaceship has its own x-axis, y-axis and z-axis, that rotate with the ship, so if the ship rotates on it's y-axis, the ship's x and z axises will rotate aswell. eg Red =xAxis, Green=yAxis and Blue = zAxis, The axis in the middle of the screen is the world x,y,z at origin, and the triangular object with the axis is the ship, at which it's axises are currently pointing. With the blue zaxis line pointing to the front of the ship. and green yAxis pointing up for the ship. The axises origin is at the ship's midpoint(of its vertices). When I view my ship from afar and roll, pitch and yaw on its midpoint, it moves as it should. But when I try and set the view to be as the first person of the ship ie: eye = shipMidPoint; at = shipZAxis; //as zAxis always points in front of the ship up = shipYAxis; // as yAxis always points up for the ship I get weird problems and rolling, yawing and pitching. eg: pitching - xaxis When it hits about 180 degrees, the screen flips, which shouldn't happen because I have set the ship's yAxis as the up vector. yawing It seems to rotate to the side then the screen rolls like 45 degrees left and right while rotating sideways rolling it rolls about 45 degrees and then rolls back and fourth, rocking similar to the rolling in the yaw. Any ideas on what is happening? I know my rotating code is fine, because Ive tested it by looking at the ship from third person view, i just can't figure out why its acting so strange. Although this is my first attempt at first-person view or a spaceship sim at that. Thanks

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