Skip to main content

dynamis_model/
config.rs

1pub struct PhysicsConfig {
2    pub gravity: [f32; 3],
3    pub damping: f32,
4    pub angular_damping: f32,
5    pub solve_iterations: u32,
6    pub position_iterations: u32,
7    pub relaxation: f32,
8    pub slop: f32,
9    pub restitution_threshold: f32,
10    pub max_velocity: f32,
11    pub max_angular_velocity: f32,
12    pub broadphase_cell_size: f32,
13    pub sleep_velocity: f32,
14    pub sleep_angular_velocity: f32,
15    pub sleep_time: f32,
16    pub wake_velocity: f32,
17}
18
19impl Default for PhysicsConfig {
20    fn default() -> Self {
21        Self {
22            gravity: [0.0, -9.81, 0.0],
23            damping: 0.05,
24            angular_damping: 0.05,
25            solve_iterations: 12,
26            position_iterations: 6,
27            relaxation: 0.8,
28            slop: 0.005,
29            restitution_threshold: 1.0,
30            max_velocity: 200.0,
31            max_angular_velocity: 400.0,
32            broadphase_cell_size: 2.0,
33            sleep_velocity: 0.2,
34            sleep_angular_velocity: 0.5,
35            sleep_time: 0.5,
36            wake_velocity: 0.4,
37        }
38    }
39}