Class FollowCamera
Hierarchy
-
TargetCamera
- FollowCamera
Index
Constructors
Properties
- camera
Acceleration - camera
Direction - camera
Rotation - height
Offset - ignore
Parent Scaling - inputs
- inverse
Rotation Speed - invert
Rotation - locked
Target - lower
Height Offset Limit - lower
Radius Limit - lower
Rotation Offset Limit - max
Camera Speed - no
Rotation Constraint - radius
- rotation
- rotation
Offset - rotation
Quaternion - speed
- update
UpVector From Rotation - upper
Height Offset Limit - upper
Radius Limit - upper
Rotation Offset Limit
Accessors
Methods
Constructors
constructor
-
Instantiates the follow camera.
Parameters
-
name: string
Define the name of the camera in the scene
-
position: Vector3
Define the position of the camera
-
scene: Scene
Define the scene the camera belong to
-
Optional lockedTarget: Nullable<AbstractMesh>
Define the target of the camera
Returns FollowCamera
-
Properties
camera AccelerationSearch playground for cameraAcceleration
Define how fast the camera can accelerate to follow it s target.
camera DirectionSearch playground for cameraDirection
Define the current direction the camera is moving to
camera RotationSearch playground for cameraRotation
Define the current rotation the camera is rotating to
height OffsetSearch playground for heightOffset
Define a height offset between the camera and the object it follows. It can help following an object from the top (like a car chaing a plane)
ignore Parent ScalingSearch playground for ignoreParentScaling
Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera
inputsSearch playground for inputs
Defines the input associated with the camera.
inverse Rotation SpeedSearch playground for inverseRotationSpeed
Speed multiplier for inverse camera panning
invert RotationSearch playground for invertRotation
Reverses mouselook direction to 'natural' panning as opposed to traditional direct panning
locked TargetSearch playground for lockedTarget
Define the target of the camera.
lower Height Offset LimitSearch playground for lowerHeightOffsetLimit
Minimum allowed height of camera position relative to target object. This can help limiting how the Camera is able to move in the scene.
lower Radius LimitSearch playground for lowerRadiusLimit
Minimum allowed distance of the camera to the axis of rotation (The camera can not get closer). This can help limiting how the Camera is able to move in the scene.
lower Rotation Offset LimitSearch playground for lowerRotationOffsetLimit
Minimum allowed angle to camera position relative to target object. This can help limiting how the Camera is able to move in the scene.
max Camera SpeedSearch playground for maxCameraSpeed
Define the speed limit of the camera following an object.
no Rotation ConstraintSearch playground for noRotationConstraint
Add constraint to the camera to prevent it to move freely in all directions and around all axis.
radiusSearch playground for radius
Distance the follow camera should follow an object at
rotationSearch playground for rotation
Define the current rotation of the camera
rotation OffsetSearch playground for rotationOffset
Define a rotation offset between the camera and the object it follows
rotation QuaternionSearch playground for rotationQuaternion
Define the current rotation of the camera as a quaternion to prevent Gimbal lock
speedSearch playground for speed
Define the current speed of the camera
update UpVector From RotationSearch playground for updateUpVectorFromRotation
When set, the up vector of the camera will be updated by the rotation of the camera
upper Height Offset LimitSearch playground for upperHeightOffsetLimit
Maximum allowed height of camera position relative to target object. This can help limiting how the Camera is able to move in the scene.
upper Radius LimitSearch playground for upperRadiusLimit
Maximum allowed distance of the camera to the axis of rotation (The camera can not get further). This can help limiting how the Camera is able to move in the scene.
upper Rotation Offset LimitSearch playground for upperRotationOffsetLimit
Maximum allowed angle to camera position relative to target object. This can help limiting how the Camera is able to move in the scene.
Accessors
target
Methods
attach ControlSearch playground for attachControl
-
Attach the input controls to a specific dom element to get the input from.
Parameters
-
Optional noPreventDefault: boolean
Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
Returns void
-
detach ControlSearch playground for detachControl
-
Detach the current controls from the specified dom element.
Returns void
get Class NameSearch playground for getClassName
-
Gets the camera class name.
Returns string
the class name
get Front PositionSearch playground for getFrontPosition
-
Gets the position in front of the camera at a given distance.
Parameters
-
distance: number
The distance from the camera we want the position to be
Returns Vector3
the position
-
get TargetSearch playground for getTarget
-
Return the current target position of the camera. This value is expressed in local space.
Returns Vector3
the target position
set TargetSearch playground for setTarget
-
Defines the target the camera should look at.
Parameters
-
target: Vector3
Defines the new target as a Vector or a mesh
Returns void
-
store StateSearch playground for storeState
-
Store current camera state of the camera (fov, position, rotation, etc..)
Returns Camera
the camera
A follow camera takes a mesh as a target and follows it as it moves. Both a free camera version followCamera and an arc rotate version arcFollowCamera are available.
https://doc.babylonjs.com/features/cameras#follow-camera