• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Mapping user input to object rotation without order/gimbol prob

## 1 post in this topic

I know this has been addressed before but the past posts seem to be geared toward cameras. So here is exactly what I would like to do and the problem I am having. Any help would be GREATLY appreciated. I am attempting to apply user control to a spaceship. I am having the well discussed problem of gimbol lock. I want a user to be able to rotate the ship using pitch, roll, and yaw. When the user pitches up, the rotation needs to be in relation to the ship. I understand the problem of rotation order. I have tried to use Quaternions but of course when I convert from pitch, roll, yaw to the quat, I get the same effects. How do you map user input to a Quaternion? Or, how do I map the current pitch, roll, and yaw of the ship to the model in a way that allows each axis to relate to it''s peer on the model, effectivly applying xyz rotation simultainiously from an origin. It is important to my applicaiton to know the exact rotation of the model at all times so simply appying rotations continuosly to a matrix doesn''t work well for that. I hope you understand what I am asking. I need to map that user input to the object. Thanks
0

##### Share on other sites
Well, I might be wrong, but the problem of the gimbal lock is that an object is rotated, but not it''s coordinate frame, so a rotated axis could map onto another axis of the static coordinate system ?
The solution would be to rotate the local coordinate system of the object.
What about maintaining 3 quaternions representing the 3 axes of rotation (x,y,z) of the object. Now, if you want to rotate around, say x, don''t rotate about the actual x-axis, but around the axis represented by the x-quaternion. Update your model with the rotation, aswell as the other two quats. This should avoid the gimbal lock ? And there is surely a simpler solution to this problem
0