Skip to main content

pite_physics/
body.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5pub enum BodyKind {
6    Static,
7    Character,
8    Rigid,
9    Area,
10}
11
12#[derive(Debug, Clone)]
13pub struct RigidBodyConfig {
14    pub mass: f32,
15    pub gravity_scale: f32,
16    pub restitution: f32,
17    pub friction: f32,
18    pub linear_damping: f32,
19    pub angular_damping: f32,
20    pub lock_rotation: bool,
21}
22
23impl Default for RigidBodyConfig {
24    fn default() -> Self {
25        Self {
26            mass: 1.0,
27            gravity_scale: 1.0,
28            restitution: 0.0,
29            friction: 0.5,
30            linear_damping: 0.0,
31            angular_damping: 0.0,
32            lock_rotation: false,
33        }
34    }
35}