Gorilla.Controller.Input.ThirdPerson Unit Reference

Overview

The Gorilla.Controller.Input.ThirdPerson unit provides TGorillaThirdPersonController, which extends the first-person controller to implement an orbital (third-person) camera. The camera is placed at a configurable distance from the character and orbits around it using mouse movement. The scroll wheel adjusts camera distance.

Classes

TGorillaThirdPersonController

Third-person orbital camera controller. The camera is positioned behind the character and rotates around it.

Inheritance: TDummy → TGorillaCharacterController → TGorillaFirstPersonController → TGorillaThirdPersonController

Platforms: All Gorilla3D supported platforms

Default Overrides

When created, the third-person controller changes these defaults from the first-person controller:

Property FirstPerson Default ThirdPerson Default
UseCameraDirection True False
RotateOnSideways False True
MoveSideways True False
CameraYAngleLimit (-180, 180) (-180, 180)
CameraXAngleLimit (-45, 45) (-45, 45)

The camera is automatically parented to the controller and positioned at (0, -Height*4, -10).

Published Properties

Property Type Default Description
MouseWheelSpeed Single 1.0 Speed of mouse wheel zoom. Range: 0–10.
CameraZLimit TPointF (-1, -25) Camera distance limits. X = closest distance, Y = farthest distance (as negative Z values).

All properties from TGorillaFirstPersonController and TGorillaCharacterController are also available.

Public Methods

constructor Create(AOwner: TComponent); override;
destructor Destroy(); override;
procedure AfterConstruction(); override;

Behavior Details

Orbit Mode (UseCameraDirection = False, default):

  • Mouse movement rotates the camera position around the character using spherical coordinates
  • The camera always looks at the character (Camera.Target := Self)
  • Mouse wheel modifies the orbital distance, clamped to CameraZLimit

Camera Direction Mode (UseCameraDirection = True):

  • Mouse movement rotates the camera and controller separately (yaw on camera, pitch on controller)
  • Mouse wheel modifies the camera Z position directly, clamped to CameraZLimit