Class FirstPersonViewComponent

First-person camera control component for entities.

class FirstPersonViewComponent
  : EntityComponent;

Constructors

NameDescription
this (eventManager, hostEntity) Constructs a first-person view component for the given entity.

Fields

NameTypeDescription
axisDeadzone floatLower threshold of controller axis value.
axisSensitivity floatSensitivity for virtual axes (controlled via keyboard or gamepad).
baseOrientation dlib.math.quaternion.Quaternion!(float)Base orientation quaternion.
direction dlib.math.vector.Vector!(float,3)Current forward direction vector.
directionHorizontal dlib.math.vector.Vector!(float,3)Forward direction ignoring pitch.
mouseActive boolTrue if mouse input is active.
mouseSensitivity floatMouse sensitivity factor.
orientationH dlib.math.quaternion.Quaternion!(float)Horizontal orientation quaternion.
orientationV dlib.math.quaternion.Quaternion!(float)Vertical orientation quaternion.
pitch floatCamera pitch angle (degrees).
pitchLimitMax floatMaximum pitch angle (degrees).
pitchLimitMin floatMinimum pitch angle (degrees).
prevMouseX intPrevious mouse X coordinate.
prevMouseY intPrevious mouse Y coordinate.
right dlib.math.vector.Vector!(float,3)Right direction vector.
roll floatCamera roll angle (degrees).
turn floatCamera turn angle (degrees).
up dlib.math.vector.Vector!(float,3)Up direction vector.
address stringAddress of this dispatcher.
enabled boolIf false, disables event processing.
entity EntityThe entity this component is attached to.
eventManager EventManagerThe event manager used for polling events.
inputManager InputManagerThe input manager for input state queries.
visible boolIf false, the component is not rendered.
domain intAddressing domain of this dispatcher.

Properties

NameTypeDescription
active[set] boolEnables or disables the component.
active[get] boolReturns whether the component is active.
useRelativeMouseMode[set] boolEnables or disables relative mouse mode.
useRelativeMouseMode[get] boolReturns whether relative mouse mode is enabled.

Methods

NameDescription
moveBack (speed) Moves the entity backward by the given speed.
moveForward (speed) Moves the entity forward by the given speed.
onFocusGain () Called when the application gains focus.
onFocusLoss () Called when the application loses focus.
reset () Resets pitch, turn, and mouse state.
strafeLeft (speed) Strafes the entity left by the given speed.
strafeRight (speed) Strafes the entity right by the given speed.
update (time) Updates the component each frame (handles input and orientation).
onControllerAdd (deviceIndex, deviceType) Called when a controller is added.
onControllerAxisMotion (deviceIndex, axis, value) Called when a controller axis is moved.
onControllerButtonDown (deviceIndex, button) Called when a controller button is pressed.
onControllerButtonUp (deviceIndex, button) Called when a controller button is released.
onControllerRemove (deviceIndex) Called when a controller is removed.
onCustomResize (x, y, width, height)
onDropFile (filename) Called when a file is dropped onto the window.
onFileChange (filename) Called when a file change is detected.
onHardwareSpecificEvent (deviceIndex, code, payload) Called when a hardware specific event is received from a custom InputDevice.
onJoystickAxisMotion (deviceIndex, axis, value) Called when a joystick axis is moved.
onJoystickButtonDown (deviceIndex, button) Called when a joystick button is pressed.
onJoystickButtonUp (deviceIndex, button) Called when a joystick button is released.
onKeyboardLayoutChange () Called when the user switches system keyboard layout.
onKeyDown (key) Called when a key is pressed.
onKeyUp (key) Called when a key is released.
onLocaleChange () Called when a user locale preferences have changed.
onMessage (domain, sender, message, payload) Called when a message event is received.
onMouseButtonDown (button) Called when a mouse button is pressed.
onMouseButtonUp (button) Called when a mouse button is released.
onMouseWheel (x, y) Called when the mouse wheel is scrolled.
onPenMotion (x, y, pressure) Called when a pen (stilus) is moved over a graphics tablet.
onQuit () Called when a quit event is received.
onResize (width, height) Called when the window is resized.
onTask (domain, sender, callback, payload) Called when a task event is received.
onTextInput (code) Called when text input is received.
onTimerEvent (timerID, userCode) Called when a timer event is received.
onUserEvent (code, payload) Called when a user event is received.
processEvent (e, enableInputEvents) Processes a single event, dispatching it to the appropriate handler.
processEvents (enableInputEvents) Processes all pending events, dispatching them to handler methods.
render (state) Override to implement rendering logic.
generateUserEvent (code, payload) Queues a user event with the given code and payload pointer.
queueLog (level, message) Queues a log event.
queueMessage (recipient, message, payload, domain) Queues a message event.
queueTask (callback, payload, domain) Queues a task event.

Description

Enables mouse and keyboard-based camera orientation and movement, supporting both relative and absolute mouse modes. Handles pitch and turn limits and configurable sensitivities.