New example showing how to go from world space to camera space.
A bit of explanation.
The black sphere is attached to the pink camera. Therefore, it is located in the camera space, meaning that its position, rotation and scale depends on the camera ones. By default, the sphere is static in the point of view of pink camera.
The pink camera is rotating around the world center.
An empty, represented as a XYZ axis, follows the mouse position.
If the space bar is hit, position & orientation of the empty is converted into camera coordinates.
Vector3 p = custom_cam.worldToCam( empty.getTrans( ) ); Quaternion q = custom_cam.worldToCam( empty.getOrientation( ) );
The values are then applied on the sphere:
ball_cam.move( p ); ball_cam.orientation( q );
By doing so, the ball is placed at the exact same location and orientation as the empty, relatively to the pink camera.
note: the 256×256 square at the top left of the images is made with overlay manager, not yet simplified in polymorph namespace.
The example is available in samples/0.1/example.cam_space