1mod body;
2mod character;
3mod collider;
4mod convert;
5mod drive;
6mod event;
7mod gravity;
8mod query;
9mod world;
10
11pub use body::{BodyDesc, BodyState, Kind, Locks, Mass};
12pub use character::{Character, CharacterDesc, Intent, Plane, TICKS};
13pub use collider::{ColliderDesc, Combine, Friction, Layers, Shape};
14pub use drive::{Drive, Ease};
15pub use event::Event;
16pub use gravity::{Falloff, Region, Source, SourceId};
17pub use query::{Filter, Hit};
18pub use world::{World, WorldDesc};
19
20#[derive(Clone, Copy, Debug, PartialEq)]
21pub struct Pose {
22 pub position: [f32; 3],
23 pub rotation: [f32; 4],
24}
25
26impl Pose {
27 pub const IDENTITY: Self = Self {
28 position: [0.0; 3],
29 rotation: [0.0, 0.0, 0.0, 1.0],
30 };
31
32 pub fn at(position: [f32; 3]) -> Self {
33 Self {
34 position,
35 ..Self::IDENTITY
36 }
37 }
38
39 pub fn new(position: [f32; 3], rotation: [f32; 4]) -> Self {
40 Self { position, rotation }
41 }
42
43 pub fn turned(self, axis: [f32; 3], angle: f32) -> Self {
44 let turn = convert::quat_axis_angle(axis, angle);
45 Self {
46 position: self.position,
47 rotation: (turn * convert::quat(self.rotation)).normalize().to_array(),
48 }
49 }
50}
51
52impl Default for Pose {
53 fn default() -> Self {
54 Self::IDENTITY
55 }
56}
57
58#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
59pub struct BodyId {
60 index: u32,
61 generation: u32,
62}
63
64#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
65pub struct ColliderId {
66 index: u32,
67 generation: u32,
68}
69
70#[cfg(test)]
71mod character_tests;
72#[cfg(test)]
73mod tests;