pite_core/nodes/
physics_body2d.rs1use crate::schema::{DefaultPropVal, NodeTypeSchema, PropHint, PropSchema};
6
7pub static SCHEMA: NodeTypeSchema = NodeTypeSchema {
8 type_name: "PhysicsBody2D",
9 description:
10 "Abstract base for solid bodies: friction and restitution. Sensors (Area2D) skip it.",
11 inherits: Some("CollisionObject2D"),
12 abstract_class: true,
13 props: PROPS,
14};
15
16pub static PROPS: &[PropSchema] = &[
17 PropSchema {
18 key: "friction",
19 label: "Friction",
20 doc: "Coulomb friction coefficient applied to contacts. 0 = ice, 0.5 = wood, 1+ = sticky.",
21 default_value: DefaultPropVal::Num(0.5),
22 hint: PropHint::Num {
23 speed: 0.05,
24 min: 0.0,
25 max: 2.0,
26 },
27 read_only: false,
28 },
29 PropSchema {
30 key: "restitution",
31 label: "Restitution",
32 doc: "Bounciness of collisions: 0 absorbs the impact, 1 bounces back with equal speed.",
33 default_value: DefaultPropVal::Num(0.0),
34 hint: PropHint::Num {
35 speed: 0.05,
36 min: 0.0,
37 max: 1.0,
38 },
39 read_only: false,
40 },
41];