1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//! # Rotate Action
//!
//! This module provides rotation functionality for kinematic character controllers.
//! It handles camera-style rotation with pitch clamping to prevent gimbal lock issues.
use ;
/// Action for applying rotation to a character's transform.
///
/// This action handles first-person or third-person camera-style rotation with:
///
/// * **Yaw Rotation**: Horizontal rotation (looking left/right)
/// * **Pitch Rotation**: Vertical rotation (looking up/down)
/// * **Pitch Clamping**: Prevents camera flipping at extreme angles
/// * **Frame-rate Independence**: Designed for mouse input that doesn't need delta time
///
/// The rotation system uses Euler angles internally but converts to quaternions
/// for the final transform to avoid gimbal lock during normal gameplay.
///
/// ## Input Handling
///
/// This action is designed primarily for mouse input, where the rotation values
/// represent the actual movement that occurred since the last frame. For gamepad
/// or keyboard input that should be frame-rate independent, you'll need to
/// multiply the rotation values by delta time before creating the action.
///
/// ## Example
///
/// ```rust
/// use bevy::math::Vec3;
/// use your_crate::actions::RotateAction;
///
/// // Mouse input (full movement since last frame)
/// let mouse_rotation = RotateAction::new(Vec3::new(mouse_delta.x, mouse_delta.y, 0.0));
///
/// // Gamepad input (should be multiplied by delta time)
/// let stick_input = Vec3::new(stick.x * delta_time, stick.y * delta_time, 0.0);
/// let gamepad_rotation = RotateAction::new(stick_input);
/// ```