• Create Account

# garrus

Member Since 16 Feb 2013
Offline Last Active Mar 06 2013 05:49 AM

### local vs world coordinate system for object manipulation

21 February 2013 - 01:45 PM

I used to do everything using vectors defined in the world coordinate system, but i'm reading up more and more about manipulating objects in their local coordinates.

For example, define every object looking towards the + Z axis, and the up direction the +Y axis, so as to simplify actions like "move forward" or "jump".

Do you have any tips/material/advice on how that's implemented?

I'm guessing i'll have to center the object to the world as mentioned above to begin with?

### rotation around left,up vector messed up (C++,openGL)

17 February 2013 - 01:12 PM

Hello.

I am implementing rotation around the up,left vectors of an object in the following way, which for some reason works only individually.
That is, i can rotate perfectly fine around up but after that, if i try rotation around left everything gets messed up.

Same if i rotate around left vector,and then try rotating around up.

Could you tell me if the following general method is correct?

vectors up,left,forward, float arrays with x,y,z components.

For example, if i want to rotate at an angle ANG, around UP (turn left/right).

1. I get the angles of the UP vector from XZ plane and the YZ plane.

Rotating the UP with these angles around the proper axes would align it with the Z axis.

2. I perform these rotations to all the vectors except UP.

3. I perfom the desired rotation with ANG, around Z.

4. I perform the opposite rotations in (2)  (again,all vectors but UP),so only the desired rotation "remains".

I could just use glRotate to visualize the rotations, but i want the forward,etc vectors as information to where the object is looking at.