Skip to main content

concinnity_core/physics/
character.rs

1// One character-capsule move and its result. A character is moved by asking
2// the simulation to resolve a desired translation against the scene rather
3// than by simulating it, so the exchange is a request in and a resolved move
4// out.
5
6use crate::physics::BodyHandle;
7use crate::physics::LayerMask;
8
9/// One character-capsule move request.
10#[derive(Debug, Clone, Copy)]
11pub struct CharacterMoveInput {
12    /// World-space capsule centre before the move.
13    pub center: [f32; 3],
14    /// Desired translation for this tick.
15    pub desired: [f32; 3],
16    /// Seconds this move covers.
17    pub dt: f32,
18    /// The moving capsule's own body, left out of the collision query.
19    pub exclude: BodyHandle,
20    /// Which layers the collision query considers.
21    pub mask: LayerMask,
22}
23
24/// Result of moving a character capsule for one tick.
25#[derive(Debug, Clone, Copy)]
26pub struct CharacterMove {
27    /// The translation actually applied after collision resolution.
28    pub translation: [f32; 3],
29    /// True when the capsule is resting on a surface after the move.
30    pub grounded: bool,
31}