Thanks Jorrit,
of course this was my first guess, but there must have been a problem between the keyboard and the chair...
For all interested here the solution:
A robot sprite could be moved around by keyboard inputs. Further on, this movement will be done by a math-model.
(Yes, if ever finished this will become a simulator for my robot-brains)
csReversibleTransform old_robot_transform =
robot_sprite->GetMovable()->GetTransform();
Pos_Rot_Type pos_d_rot = Get_D_PosRot(); // keyboard inputs increment / decrement rot-angles and position
// Rotate the robot relative
csXRotMatrix3 XRotMat (pos_d_rot.Rotation.Nick);
csYRotMatrix3 YRotMat (pos_d_rot.Rotation.Gier);
csZRotMatrix3 ZRotMat (pos_d_rot.Rotation.Roll);
old_robot_transform.RotateThis (YRotMat * XRotMat * ZRotMat);
robot_sprite->GetMovable()->SetTransform(old_robot_transform);
// move the robot relative
csVector3 translation =
old_robot_transform.This2Other(csVector3 (pos_d_rot.Position.Ix,
pos_d_rot.Position.Iy,
pos_d_rot.Position.Iz));
robot_sprite->GetMovable()->SetPosition (translation);
// Makes no sense here, but shows how to get the whole transformation of the object.
// This is needed, in case of logging the transforms to disk (together with other values).
csMatrix3 same_matrix =
robot_sprite->GetMovable()->GetTransform().GetT2O();
csVector3 same_vector =
- robot_sprite->GetMovable()->GetTransform().GetT2OTranslation(); // negate the vector (why needed ??)
csReversibleTransform same_transform (same_matrix, same_vector);
robot_sprite->GetMovable()->SetTransform(same_transform); // just verify, its the same tranlation as before
csPrintf ("vect X / Y / Z = %f %f %f; \n",
same_vector.x, same_vector.y, same_vector.z);
csPrintf ("Trans X / Y / Z = %f %f %f; \n\n",
translation.x, translation.y, translation.z);
Update_Act_PosRot(); // clear keyboart inputs
robot_sprite->GetMovable()->UpdateMove ();
Greetings,
Harald