0

First of all, I am just getting started on rotations, quaternions and matrices so excuse me already for some parts I misunderstand at this moment.

Situation:

An OSX SceneKit application.

I have a 3D space, X+ right, Y+ Forward, Z+ Up.

Inside this space I have a disk:

  • Center {x: 2.0, y: 2.0 z: 2.0}
  • Radius 2.0

In the center of this arc I made some controls which I am able to set a rotation to the disk, in all 3 axes. Pitch (Y axis), Roll (X axis) Yaw (Z axis). What I want to achieve is that no matter what the current angles of this disk are, when I adjust the angles using the Pitch control I want it to rotate not in its local body frame, but in the 'main' frame. The controls do not rotate with it, and stay flat in the 'main' frame as well.

Little more details, when I roll the disk 90deg. and I apply Pitch to it, I do not want it to Pitch in its local body frame but actually YAW in its local body frame.

So what I am practically looking for is a way to rotate my 'input adjustments' in some sort of way that the disk rotates just as I tried to describe above. I do know how to rotate a vector, but I am stuck on how to handle roll, pitch,yaw orientation rotations.

Any help would be appreciated!

Tom

Tom Vos
  • 410
  • 1
  • 5
  • 13
  • take a look at [Understanding 4x4 homogenous transform matrices](https://stackoverflow.com/a/28084380/2521214) and see the difference between local and global transforms. If I where you I would use cumulative transform matrices instead of Euler angles... (see the last links in there) as they have many advantages ... and you need their result for rendering anyway ... – Spektre Oct 13 '17 at 07:25

1 Answers1

0

You do three consecutive rotations. The combined rotation matrix is

E = R_Z(yaw)*R_X(pitch)*R_Y(roll)

where each of R_X(), R_Y() and R_Z() and elemental 3×3 roation matrices. See Basic Rotations (wikipedia) for the components of each.

John Alexiou
  • 28,472
  • 11
  • 77
  • 133