Hi,
I've just started to use this framework and it seems great, but I’m having some problems implementing my ideas.
I try to rotate a large object with the joystick in center of the screen, but I don’t seem to get what I want.
Here’s the code:
CGPoint delta = ccpMult(playerDirectionControl, dt * 10.0);
CC3MeshNode* bunny = (CC3MeshNode*)[self getNodeNamed:@"bunny"];
NSLog(@"dx:%f dy%f:" ,delta.x, delta.y);
CC3Vector4 quaternion = bunny.quaternion;
double angle = sqrt(delta.x * delta.x + delta.y * delta.y);
CC3Vector4 axisQuat = CC3Vector4Make(delta.x * sin(angle/2), delta.x * sin(angle/2), 0.0, cos(angle/2));
CC3Vector4 quatMult = [self quatMult:quaternion second:axisQuat];
[bunny setQuaternion:quatMult];
If I understand correctly, I should get coordinates from the joystick and create a quaternion from them
and then multiply it with the present quaternion of the object.
Any suggestions?