Code: Select all
void HandleDown(Key key)
{
switch (key)
{
case KEY_w:
db->ApplyForce(-moveDir.GetNormalize());
break;
case KEY_s:
db->ApplyForce(moveDir.GetNormalize());
break;
}
}
Now I'm about to implement turning, that is using 'a' and 'd'; How would I do this, when I have to take into account, that the sphere could be turning on each axis?
I tried vector crossing, and that works, but only if the Sphere is only turning on one axis, that is for a single turn it works.
Update:
I'm now doing the following:
Code: Select all
db->ApplyTorque((db->GetRotation().GetMatrix()*-rel_pos)%force);