PhysicsCamera
new PhysicsCamera(physics : Object, options : Object)Create a PhysicsCamera.
Constructor Parameters
physicsObjectPhysics instance
optionsoptionalObjectCamera options
Default is
Default is
{}.fovoptionalnumberField of view in degrees
Default is70.aspectoptionalnumberAspect ratio (updated on resize)
Default is1.nearoptionalnumberNear clipping plane
Default is0.1.faroptionalnumberFar clipping plane
Default is1000.targetoptionalTHREE.Object3DTarget object to follow
Default isnull.
Properties
# .physics : Object
Reference to Physics instance.
# .target : THREE.Object3D|null
Target object the camera follows.
Methods
update#
update(delta : number)Update camera state. Must be called each frame. Implement in subclass.
Parameters
deltanumberTime delta in seconds
setTarget#
setTarget(target : THREE.Object3D) : thisSet the target object the camera follows.
Parameters
targetTHREE.Object3DObject to follow
Returns
this — For chainingresize#
resize(width : number, height : number) : thisHandle window resize. Updates aspect ratio and projection matrix.
Parameters
widthoptionalnumberNew width
Default is
Default is
window.innerWidth.heightoptionalnumberNew height
Default is
Default is
window.innerHeight.Returns
this — For chainingdispose#
dispose()Clean up resources and event listeners. Call when camera is no longer needed.