Avara3D 0.2.0
C++ API reference
FlyCameraController.h
1//
2// FlyCameraController.h
3// avara3d
4//
5// Created by Morgan Davis on 8/9/26.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_EXTENSION_CAMERA_FLYCAMERACONTROLLER_H
10#define AVARA3D_EXTENSION_CAMERA_FLYCAMERACONTROLLER_H
11
12#include "a3d/input/DesktopInputContext.h"
13
14namespace a3d {
15
16 class Node;
17
18}
19
20namespace a3d::ext {
21
30
31 public:
32 // [Public Types]
33
35 struct Controls {
36
37 DesktopInputContext::Key forward {DesktopInputContext::Key::W};
38 DesktopInputContext::Key back {DesktopInputContext::Key::S};
39 DesktopInputContext::Key left {DesktopInputContext::Key::A};
40 DesktopInputContext::Key right {DesktopInputContext::Key::D};
41 DesktopInputContext::Key up {DesktopInputContext::Key::Space};
42 DesktopInputContext::Key descendModifier {DesktopInputContext::Key::LeftShift};
43 DesktopInputContext::Key fastModifier {DesktopInputContext::Key::LeftControl};
44 };
45
47 struct Config {
48
49 float lookSensitivity {0.001f};
50 float moveSpeed {1.0f};
51 float fastMoveMultiplier {2.0f};
53 };
54
55 // [Public Lifecycle Functions]
56
59
62
63 // [Public Member Functions]
64
66 const Config& config() const;
67
69 void config(const Config& config);
70
82 bool update(Node& pov, DesktopInputContext& input, double deltaTime);
83
84 private:
85 // [Private Member Variables]
86
87 Config _config;
88 };
89
90}
91
92#endif // AVARA3D_EXTENSION_CAMERA_FLYCAMERACONTROLLER_H
Exposes keyboard, pointer-button, pointer-motion, and scroll state.
Key
Identifies keyboard keys reported by desktop-style input contexts.
A transformable object in a Scene hierarchy.
Definition: Node.h:45
Applies free-flight keyboard and pointer controls to a point-of-view Node.
const Config & config() const
Returns the current controller configuration.
FlyCameraController(const Config &config)
Creates a FlyCameraController with config.
FlyCameraController()
Creates a FlyCameraController with the default configuration.
void config(const Config &config)
Replaces the controller configuration.
bool update(Node &pov, DesktopInputContext &input, double deltaTime)
Updates pov from the current input state.
Free-flight sensitivity, speed, and control bindings.
float fastMoveMultiplier
Multiplier applied to moveSpeed while the fast modifier is held.
float lookSensitivity
Pointer-look sensitivity applied to logical pointer displacement.
Controls controls
Keyboard bindings used for translation and speed control.
float moveSpeed
Translation speed in scene units per second.
Key bindings used for free-flight translation and speed control.
DesktopInputContext::Key forward
Move along the POV's forward axis.
DesktopInputContext::Key descendModifier
Reverses the up control while held.
DesktopInputContext::Key back
Move opposite the POV's forward axis.
DesktopInputContext::Key left
Move opposite the POV's right axis.
DesktopInputContext::Key up
Move along the POV's up axis.
DesktopInputContext::Key right
Move along the POV's right axis.
DesktopInputContext::Key fastModifier
Applies the fast-movement multiplier while held.