Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Camera3D

[17:7] extends: FxObj

Wraps FXGL's Camera3D (com.almasb.fxgl.app.scene.Camera3D), a convenience wrapper around a JavaFX PerspectiveCamera with a TransformComponent for position and rotation, plus tpf-scaled move helpers (moveForward, moveLeft, etc.). Used by 3D games to drive a first-person or follow camera. Bind the underlying PerspectiveCamera (getPerspectiveCamera) to a SubScene to render its view.

Methods

  • Camera3D (bool Construct = true)

    Creates a new Camera3D. The default position is (0, 0, -15) with a 60-degree field of view and 1000-unit far clip. Pass false to construct an empty wrapper for adopt.

    • @p Construct is true to instantiate immediately, false for an empty wrapper.
  • adopt (object Ajo)

    Wraps an existing Camera3D AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a Camera3D.
    • @r A new wrapper.
  • getTransform ()

    Returns the camera's TransformComponent (position, rotation, world-relative move helpers).

    • @r An AussomJavaObject around a TransformComponent.
  • getPerspectiveCamera ()

    Returns the underlying JavaFX PerspectiveCamera. Bind this to a SubScene to render the 3D view.

    • @r An AussomJavaObject around a PerspectiveCamera.
  • getMoveSpeed ()

    Returns the per-second move speed (units per second).

    • @r A double.
  • setMoveSpeed (double Speed)

    Sets the per-second move speed.

    • @p Speed is the new move speed in units per second.
    • @r this object
  • isOverRotationXAllowed ()

    Returns whether the X-axis rotation is allowed outside the (-90, 90) range.

    • @r A bool.
  • setOverRotationXAllowed (bool Allowed)

    Sets whether the X-axis rotation may go outside the (-90, 90) range.

    • @p Allowed is the new flag value.
    • @r this object
  • update (double Tpf)

    Advances the camera's tpf-scaled move budget by the given frame time.

    • @p Tpf is the per-frame time in seconds.
    • @r this object
  • moveForward ()

    Moves the camera forward (along its facing direction) by the current tpf-scaled move budget.

    • @r this object
  • moveBack ()

    Moves the camera backward (opposite its facing direction) by the current tpf-scaled move budget.

    • @r this object
  • moveForwardXZ ()

    Moves the camera forward in the XZ plane only (no Y change), for walking-style movement that ignores pitch.

    • @r this object
  • moveBackXZ ()

    Moves the camera backward in the XZ plane only.

    • @r this object
  • moveLeft ()

    Moves the camera left along its right-axis vector.

    • @r this object
  • moveRight ()

    Moves the camera right along its right-axis vector.

    • @r this object