omega-game-engine
    Preparing search index...

    CameraFlyBehaviour

    • Implements a free-look camera controller, often referred to as "flycam" or "FPS camera."
    • It allows movement with W/A/S/D/Q/E keys and rotation with mouse input.
    • The movement includes smooth acceleration and deceleration, and rotation is smoothly dampened.
    • This behaviour can be attached to an Entity to control its transform,
    • making it behave like a camera in a 3D scene.

    Hierarchy (View Summary)

    Indexable

    • [key: string]: any
    Index

    Constructors

    Properties

    _acceleration: number = 4.0

    The rate at which the camera accelerates to moveSpeed.

    10
    
    _className: string
    _currentPitch: number = 0

    Current accumulated pitch (vertical rotation) in degrees.

    _currentYaw: number = 0

    Current accumulated yaw (horizontal rotation) in degrees.

    _forwardVelocity: number = 0

    Current forward/backward velocity.

    _initialized: boolean = false

    A flag indicating if the behaviour has been initialized.

    _serializationIgnoreKeys: string[]
    _strafeVelocity: number = 0

    Current strafe (left/right) velocity.

    _upVelocity: number = 0

    Current up/down velocity.

    _uuid: string
    active: boolean = true

    Indicates whether the behaviour is currently active. An inactive behaviour will not have its update method called.

    boostMultiplier: number = 4.0

    The multiplier applied to moveSpeed when the boost key is held down.

    2.0
    
    lookMouseButtons: ICameraMouseButtons = ...

    The mouse button mappings for camera controls.

    moveDampening: number = 0.15

    The dampening factor for movement. A higher value means movement stops faster. Value between 0 and 1.

    0.15
    
    moveKeys: ICameraMoveKeys = ...

    The key mappings for movement controls.

    moveSpeed: number = 20

    The maximum speed at which the camera can move.

    20
    
    name: string = ''
    parent: SceneEntity

    The parent entity to which this behaviour is attached.

    renderLayer: RenderLayer = RenderLayer.OPAQUE

    The render layer this behaviour belongs to. This is used to determine the rendering order of the entity.

    rotationDampening: number = 0.20

    The dampening factor for rotation. A higher value means rotation snaps faster. Value between 0 and 1.

    0.4
    
    rotationSpeed: number = 5.0

    The sensitivity of mouse input for camera rotation.

    3.0
    
    scrollSpeed: number = 1

    The sensitivity of the mouse scroll wheel for moving forward and backward.

    1.0
    

    Accessors

    • get transform(): Transform

      Gets the transform component of the parent entity. This provides easy access to the position, rotation, and scale of the entity.

      Returns Transform

    Methods

    • Protected

      Applies the calculated movement velocities to the entity's transform.

      Parameters

      • transform: Transform

        The transform to modify.

      • ellapsed: number

        The time elapsed since the last frame.

      Returns void

    • Protected

      Applies the calculated rotation velocities to the entity's transform.

      Parameters

      • transform: Transform

        The transform to modify.

      • ellapsed: number

        The time elapsed since the last frame.

      Returns void

    • Updates the behaviour specifically for editor mode. This method is called on every frame when the engine is in editor mode.

      Parameters

      • elapsed: number

        The time elapsed since the last frame in seconds.

      Returns void

    • Updates the forward/backward velocity based on input.

      Parameters

      • accelerationDelta: number

        The acceleration to apply for this frame.

      • maxSpeed: number

        The maximum speed.

      • stopThreshold: number

        The velocity below which movement stops completely.

      Returns void

    • Protected

      Main input processing loop called every frame.

      Parameters

      • ellapsed: number

        The time elapsed since the last frame.

      Returns void

    • Protected

      Updates all movement velocities based on key inputs.

      Parameters

      • ellapsed: number

        The time elapsed since the last frame.

      Returns void

    • Protected

      Updates the camera's pan velocity based on mouse movement.

      Parameters

      • ellapsed: number

      Returns void

    • Protected

      Updates the forward velocity based on mouse scroll wheel input.

      Parameters

      • ellapsed: number

      Returns void

    • Updates the strafe (left/right) velocity based on input.

      Parameters

      • accelerationDelta: number

        The acceleration to apply for this frame.

      • maxSpeed: number

        The maximum speed.

      • stopThreshold: number

        The velocity below which movement stops completely.

      Returns void

    • Updates the up/down velocity based on input.

      Parameters

      • accelerationDelta: number

        The acceleration to apply for this frame.

      • maxSpeed: number

        The maximum speed.

      • stopThreshold: number

        The velocity below which movement stops completely.

      Returns void