Log in or register to post comments

How does SampleUtils::setRotationMatrix() work?

September 11, 2012 - 4:41am #1


can someone please explain to me how the SampleUtils::setRotationMatrix() Method works?

I would like to rotate my 3D Modell with touch events
e.g.: If you move your finger to the left/right/up/down the model should rotate in that direction as long as the finger touches the screen

well i kind of found out how to handle touches and I also get the coordinates of the touch but I can't figure out how to properly use them with SampleUtils::setRotationMatrix()

can I use the SampleUtils::setRotationMatrix() Method to rotate my 3D Model around 2 Axes at the same time?
I'm a bit confused about that ^^;

I would be very grateful for any suggestions :3

-best regards

How does SampleUtils::setRotationMatrix() work?

September 12, 2012 - 4:16am #3

Thanks, that really helped me a lot :3

I'm now able to read out the touch events and can adjust the angle of the cube accordingly for x and y axis.

Although there is still a little problem..
When i use them in sequence then the cube is rotated along the x axis first and along the y axis afterwards.
So when I rotate the cube about 90° around both axes then the rotation around the x axis will be correct,
but the "second" rotation follows the new position of the x axis and will not rotate around the "original" y axis.
(i hope you know what i mean.. ^^;)

Is there a way to change that behaviour?

How does SampleUtils::setRotationMatrix() work?

September 11, 2012 - 12:46pm #2

Take a look at the Dominoes sample for an example of how to handle touch events, project them onto the target, and to apply rotations to your models. An easier way to apply rotations will be to use the SampleUtils::RotatePoseMatrix method, which is demonstrated in updateDominoTransform() and updatePickingTransform() in Dominoes.cpp. And you can apply rotations on two axes, though only by the same angle, with this method. Otherwise you'll need to apply them in sequence.

Log in or register to post comments