Manipulator
Helper that enables camera interaction similar to sketchfab or Google Maps.
Clients notify the manipulator of various mouse or touch events, then periodically call getLookAt so that they can adjust their camera. Three modes are supported: Mode.ORBIT, Mode.MAP, and Mode.FREE_FLIGHT. To construct a manipulator, use Builder and pass the desired mode to Builder.build.
Usage example:
val manip = Manipulator.Builder()
.viewport(1024, 768)
.build(Mode.ORBIT)
// In mouse-down handler:
manip.grabBegin(x, y, false)
// In mouse-move handler:
manip.grabUpdate(x, y)
// In mouse-up handler:
manip.grabEnd()
// Each frame:
val eye = FloatArray(3); val target = FloatArray(3); val up = FloatArray(3)
manip.getLookAt(eye, target, up)
camera.lookAt(eye[0], eye[1], eye[2], target[0], target[1], target[2], up[0], up[1], up[2])See also
Types
Builder for Manipulator instances.
Keys used to translate the camera in Mode.FREE_FLIGHT mode.
Properties
A new Bookmark of the current position, for jumpToBookmark.
A new Bookmark of the home position, for jumpToBookmark.
The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.
Functions
Gets the current orthonormal basis; this is usually called once per frame. Each array (size ≥ 3) receives a world-space position or direction.
Sets the manipulator position and orientation back to a stashed state.
Signals that a key is now in the down state.
Signals that a key is now in the up state.
In Mode.MAP and Mode.ORBIT modes, dollys the camera along the viewing direction. In Mode.FREE_FLIGHT mode, adjusts the move speed of the camera.
Sets the viewport dimensions. The manipulator uses this to process grab events and raycasts.