Class FlyCamera
Hierarchy
-
TargetCamera
- FlyCamera
Index
Constructors
Properties
- _track
Roll - apply
Gravity - banked
Turn - banked
Turn Limit - banked
Turn Multiplier - camera
Direction - camera
Rotation - check
Collisions - ellipsoid
- ellipsoid
Offset - ignore
Parent Scaling - inputs
- inverse
Rotation Speed - invert
Rotation - locked
Target - no
Rotation Constraint - on
Collide - roll
Correct - rotation
- rotation
Quaternion - speed
- update
UpVector From Rotation
Accessors
Methods
Constructors
constructor
-
Instantiates a FlyCamera. This is a flying camera, designed for 3D movement and rotation in all directions, such as in a 3D Space Shooter or a Flight Simulator.
Parameters
-
name: string
Define the name of the camera in the scene.
-
position: Vector3
Define the starting position of the camera in the scene.
-
scene: Scene
Define the scene the camera belongs to.
-
Optional setActiveOnSceneIfNoneActive: boolean
Defines wheter the camera should be marked as active, if no other camera has been defined as active.
Returns FlyCamera
-
Properties
_track RollSearch playground for _trackRoll
Track Roll to maintain the wanted Rolling when looking around.
apply GravitySearch playground for applyGravity
Enable or disable gravity on the camera.
banked TurnSearch playground for bankedTurn
Mimic a banked turn, Rolling the camera when Yawing. It's recommended to use rollCorrect = 10 for faster banking correction.
banked Turn LimitSearch playground for bankedTurnLimit
Limit in radians for how much Roll banking will add. (Default: 90°)
banked Turn MultiplierSearch playground for bankedTurnMultiplier
Value of 0 disables the banked Roll. Value of 1 is equal to the Yaw angle in radians.
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
check CollisionsSearch playground for checkCollisions
Enable or disable collisions of the camera with the rest of the scene objects.
ellipsoidSearch playground for ellipsoid
Define the collision ellipsoid of the camera. This is helpful for simulating a camera body, like a player's body.
ellipsoid OffsetSearch playground for ellipsoidOffset
Define an offset for the position of the ellipsoid around the camera. This can be helpful if the camera is attached away from the player's body center, such as at its head.
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
The inputs manager loads all the input sources, such as keyboard and mouse.
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 current target of the camera as an object or a position.
no Rotation ConstraintSearch playground for noRotationConstraint
Add constraint to the camera to prevent it to move freely in all directions and around all axis.
on CollideSearch playground for onCollide
Event raised when the camera collides with a mesh in the scene.
Type declaration
-
-
Parameters
-
collidedMesh: AbstractMesh
Returns void
-
-
roll CorrectSearch playground for rollCorrect
Slowly correct the Roll to its original value after a Pitch+Yaw rotation.
rotationSearch playground for rotation
Define the current rotation of the camera
rotation QuaternionSearch playground for rotationQuaternion
Define the current local rotation of the camera as a quaternion to prevent Gimbal lock. This overrides and empties cameraRotation.
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
Accessors
angular Sensibility
-
Gets the input sensibility for mouse input. Higher values reduce sensitivity.
Returns number
-
Sets the input sensibility for a mouse input. Higher values reduce sensitivity.
Parameters
-
value: number
Returns any
-
collision Mask
-
Get the mask that the camera ignores in collision events.
Returns number
-
Set the mask that the camera ignores in collision events.
Parameters
-
mask: number
Returns any
-
keys Backward
-
Get the keys for camera movement backward.
Returns number[]
-
Get the keys for camera movement backward.
Parameters
-
value: number[]
Returns any
-
keys Down
-
Get the keys for camera movement down.
Returns number[]
-
Set the keys for camera movement down.
Parameters
-
value: number[]
Returns any
-
keys Forward
-
Get the keys for camera movement forward.
Returns number[]
-
Set the keys for camera movement forward.
Parameters
-
value: number[]
Returns any
-
keys Left
-
Get the keys for camera movement left.
Returns number[]
-
Set the keys for camera movement left.
Parameters
-
value: number[]
Returns any
-
keys Right
-
Set the keys for camera movement right.
Returns number[]
-
Set the keys for camera movement right.
Parameters
-
value: number[]
Returns any
-
keys Up
-
Get the keys for camera movement up.
Returns number[]
-
Set the keys for camera movement up.
Parameters
-
value: number[]
Returns any
-
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 a control from the HTML DOM element. The camera will stop reacting to that input.
Returns void
disposeSearch playground for dispose
-
Destroy the camera and release the current resources held by it.
Returns void
get Class NameSearch playground for getClassName
-
Get the current object 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
This is a flying camera, designed for 3D movement and rotation in all directions, such as in a 3D Space Shooter or a Flight Simulator.