v0.3.0 API Reference
WanderRotator.h
1//
2// WanderRotator.h
3// avara3d
4//
5// Created by Morgan Davis on 7/21/26.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_EXTENSION_WANDERROTATOR_H
10#define AVARA3D_EXTENSION_WANDERROTATOR_H
11
12#include "a3d/Math.h"
13
14namespace a3d {
15
16class Node;
17
18} // namespace a3d
19
20namespace a3d::ext {
21
29
30public:
31 // [Public Member Variables]
32
33 float minInterval {0.8f};
34 float maxInterval {2.5f};
35 float minSpeed {0.5f};
36 float maxSpeed {1.0f};
37 float smoothing {1.0f};
38
39 // [Public Member Functions]
40
42 void update(Node& node, float deltaTime);
43
44private:
45 // [Private Member Functions]
46
47 void chooseNewTarget();
48
49 // [Private Member Variables]
50
51 float _timer {0.0f};
52 float _nextChange {1.0f};
53
54 math::vec3 _angularVelocity {0.0f, 0.0f, 0.0f};
55 math::vec3 _targetAngularVelocity {0.0f, 0.0f, 0.0f};
56};
57
58} // namespace a3d::ext
59
60#endif // AVARA3D_EXTENSION_WANDERROTATOR_H
A transformable object in a Scene hierarchy.
Definition: Node.h:45
Applies smoothly varying random rotation to a Node.
Definition: WanderRotator.h:28
float minInterval
Minimum time between target changes, in seconds.
Definition: WanderRotator.h:33
void update(Node &node, float deltaTime)
Advances the rotation by deltaTime seconds and applies it to node.
float maxSpeed
Maximum target angular speed, in radians per second.
Definition: WanderRotator.h:36
float smoothing
Smoothing rate toward target angular velocity; larger values respond faster.
Definition: WanderRotator.h:37
float maxInterval
Maximum time between target changes, in seconds.
Definition: WanderRotator.h:34
float minSpeed
Minimum target angular speed, in radians per second.
Definition: WanderRotator.h:35