Class AirshipCameraSingleton

This class is responsible for:

  • Changing field of view when swapping to and from first person (they use different fov values)
  • Increasing field of view when sprinting
  • Allow toggling to and from first person by toggling the ViewmodelCamera

Properties

cameraSystem?: CameraSystem

The underlying camera system for the game.

characterState: undefined | CharacterStateSnapshot

Current state of local character (relevant to the camera system).

firstPersonChanged: Signal<[isFirstPerson: boolean]> = ...

Fires whenever the user changes their first-person state.

lookBackwardsChanged: Signal<[lookBackwards: boolean]> = ...

Fires whenever the user requests to look (or stop looking) backwards.

Methods

  • Sets the camera to a static view.

    Returns void

  • Returns the camera's field-of-view.

    Parameters

    • targetCamera: CharacterCameraType

    Returns number

  • Returns the CameraMode of type T.

    You likely want to pass the generic GetMode<FixedCameraMode>(), or whatever mode your game uses.

    Type Parameters

    Returns undefined | T

    The CameraMode, if it exists. Otherwise, undefined.

  • Returns true if the camera system is enabled.

    Returns undefined | boolean

  • If Field of View is managed, camera fov will be updated by tweens. You must control the FOV by calling SetFOV

    It's useful to turn this off when you want to manage FOV entirely yourself.

    Returns boolean

    true if FOV is being managed by the CharacterCamera system.

  • Returns true if the player is in first-person mode.

    Returns boolean

  • Updates FOV to reflect the current character state object

    Returns void

  • Observes the current first-person state.

    Parameters

    Returns (() => void)

      • (): void
      • Returns void

  • Observes whether or not the player wants to look backwards.

    Parameters

    Returns (() => void)

      • (): void
      • Returns void

  • Sets whether or not the camera system is enabled. Disable the camera system if custom camera code is being used.

    Parameters

    • enabled: boolean

    Returns void

  • Set the camera's field-of-view.

    Parameters

    • targetCameraType: CharacterCameraType
    • fieldOfView: number

      Field of view.

    • smooth: boolean = false

      If true the FOV will transition smoothly to the target.

    Returns void

  • Sets if camera FOVs should be tweened.

    Parameters

    • shouldManage: boolean

      True if camera FOVs should be tweened by this class.

    Returns void

  • Changes the preferred perspective for the local character.

    This will only work if using CharacterCameraMode.Fixed. You can set this with ()

    Parameters

    • value: boolean

    Returns void

  • Sets a new CharacterCameraMode. If the local character does not exist when this function is called, the camera mode's target is set to a GameObject located at Vector3.zero.

    Parameters

    • characterCameraMode: CharacterCameraMode

      A CharacterCameraMode.

    Returns CameraMode

  • Sets and returns a new custom CameraMode.

    Parameters

    • mode: CameraMode

      The CameraMode that is being set.

    Returns CameraMode

    The new CameraMode.

  • Set the current camera mode.

    Parameters

    Returns void

  • Sets multiplier on base FOV when sprinting. For example if FOV is 80 and multipler is 1.1 the player FOV while sprinting will be 88.

    Parameters

    • multipler: number

      Sprint FOV multiplier, set to 1 to disable sprint FOV. Defaults to 1.08

    Returns void

  • Shutdown the whole Airship.Character camera system.

    This will cause the CameraRig to stop being controlled in any way.

    Returns void