Skip to main content

concinnity_physics/
character.rs

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