I'm using Cocos3D on iOs. I need to rotate an object using pan gesture.
switch (gesture.state)
{
case UIGestureRecognizerStateBegan:
saveState = Dobj.rotation;
break;
case UIGestureRecognizerStateChanged:
CC3Vector rotateVector = CC3VectorMake(gesture.translation.y, gesture.translation.x, 0.0f);
Dobj.rotation = CC3VectorAdd(saveState, rotateVector);
break;
case UIGestureRecognizerStateEnded:
break;
default:
break;
}
This way I can get my object(Dobj
) to rotate on itself. But it seems that the axis is also rotating and that is causing some really weird rotation.
How can I fix this ?