Skip to main content

pite_core/nodes/
collision_object2d.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2//! Abstract base for collision participants: collision_layer, collision_mask.
3
4use crate::schema::{DefaultPropVal, NodeTypeSchema, PropHint, PropSchema};
5
6pub static SCHEMA: NodeTypeSchema = NodeTypeSchema {
7    type_name: "CollisionObject2D",
8    description: "Abstract base for collision participants: collision_layer and collision_mask.",
9    inherits: Some("Node2D"),
10    abstract_class: true,
11    props: PROPS,
12};
13
14pub static PROPS: &[PropSchema] = &[
15    PropSchema {
16        key: "collision_layer",
17        label: "Layer",
18        doc: "Bitmask of physics layers this body belongs to (1 = layer 1, 2 = layer 2, …).",
19        default_value: DefaultPropVal::Int(1),
20        hint: PropHint::Int {
21            speed: 1.0,
22            min: 1,
23            max: 256,
24        },
25        read_only: false,
26    },
27    PropSchema {
28        key: "collision_mask",
29        label: "Mask",
30        doc: "Bitmask of physics layers this body collides with.",
31        default_value: DefaultPropVal::Int(1),
32        hint: PropHint::Int {
33            speed: 1.0,
34            min: 1,
35            max: 256,
36        },
37        read_only: false,
38    },
39];