Creates a new CameraChaser instance for the specified target object.
The constructor automatically hooks into the target's onBeforeRender callback to perform camera following calculations. The original onBeforeRender function is preserved and can be restored via the dispose method.
The Three.js object that should follow the camera
Controls whether horizontal camera following is enabled.
When set to true
, the target object will rotate around the Y-axis to face
the camera horizontally on each frame. When false
, no rotation occurs.
Flag indicating whether the world position cache needs updating.
Set this to true
if the target object's position has changed and you want
the camera chaser to recalculate the world position on the next frame.
Automatically reset to false
after the update.
Releases resources and restores the target object's original state.
This method should be called when the CameraChaser is no longer needed to prevent memory leaks and restore the target's original onBeforeRender function. After calling dispose, the CameraChaser instance should not be used.
Provides horizontal-only camera following functionality for Three.js objects.
CameraChaser enables objects to rotate around the Y-axis to face the camera horizontally, while maintaining their vertical orientation. This is particularly useful for UI elements, signs, or billboards that should face the camera but remain upright.
Key Features
Usage with Billboard Classes
CameraChaser is automatically integrated with mesh-based billboard classes such as BillboardPlane, SharedStagePlaneMesh, and MultiViewPixiPlaneMesh. For full camera facing on all axes, use the Billboard class (Sprite-based) instead.
Important Limitations
Example