I want to rotate a view around the three axis, with 3 different angles : rx, ry, rz.
Here's what I done :
_tx = CATransform3DMakeRotation(rx*M_PI/360, 1, 0, 0);
_ty = CATransform3DMakeRotation(ry*M_PI/360, 0, 1, 0);
_tz = CATransform3DMakeRotation(rz*M_PI/360, 0, 0, 1);
view.layer.transform = CATransform3DConcat(_tx, CATransform3DConcat(_ty, _tz));
I though it was working when I tried to invert the concatenation order. For example,
view.layer.transform = CATransform3DConcat(_tx, CATransform3DConcat(_ty, _tz));
and
view.layer.transform = CATransform3DConcat(_tz, CATransform3DConcat(_tx, _ty));
Do not give the same result !!
- Is there a way to rotate around the 3 axis with one
CATransform3DMakeRotation
?
- Or a better way to do this?