Navigation along the structure.
After some refactoring, the system starts to behave nicely:
- objects position, size and orientation are described in an xml, much easier to modify
- gaps (the space between joints, marked by a white sphere), are rendered automatically by the engine
- camera rig (a hierarchy of objects including camera and lights) is able to move along the structure, from cluster (orange boxes) to boxes
- when 2 gaps are vailable in a cluster, it’s possible to choose wich one to solve
- camera orient itself according to the selected gap
I have to plug back the resolution of gaps, disabled for now. Moving a segment will cause issue, for sure. More about this very soon!
The tricky point was to manage the camera correctly when its orientation is not aligned with the world axis anymore. The camera is parented to a node called origin. When the orientation of origin change, the UP axis used to update camera has to be given before calling lookAt for instance.
Vector3 local_up( 0,1,0 );
local_up = origin->getOrientation() * local_up;
cam->setFixedYawAxis( false, local_up );
cam->lookAt( origin->getPosition() );