3#include "pixelbullet/physics/physics_serialization.h"
4#include "pixelbullet/physics/physics_types.h"
5#include "pixelbullet/serialization/glm_node.h"
6#include "pixelbullet/serialization/node.h"
13 ColliderShapeType shape = ColliderShapeType::Box;
14 glm::vec3 box_half_extents = glm::vec3(0.5f);
15 float sphere_radius = 0.5f;
16 float capsule_radius = 0.5f;
17 float capsule_half_height = 0.5f;
18 glm::vec3 center = glm::vec3(0.0f);
19 float friction = 0.5f;
20 float restitution = 0.0f;
21 bool is_trigger =
false;
28 node[
"enabled"] << component.enabled;
29 node[
"shape"] << component.shape;
30 node[
"boxHalfExtents"] << component.box_half_extents;
31 node[
"sphereRadius"] << component.sphere_radius;
32 node[
"capsuleRadius"] << component.capsule_radius;
33 node[
"capsuleHalfHeight"] << component.capsule_half_height;
34 node[
"center"] << component.center;
35 node[
"friction"] << component.friction;
36 node[
"restitution"] << component.restitution;
37 node[
"isTrigger"] << component.is_trigger;
41inline const Node& operator>>(
const Node& node, ColliderComponent& component)
43 if (node.has_property(
"enabled"))
45 node[
"enabled"] >> component.enabled;
47 if (node.has_property(
"shape"))
49 node[
"shape"] >> component.shape;
51 if (node.has_property(
"boxHalfExtents"))
53 node[
"boxHalfExtents"] >> component.box_half_extents;
55 if (node.has_property(
"sphereRadius"))
57 node[
"sphereRadius"] >> component.sphere_radius;
59 if (node.has_property(
"capsuleRadius"))
61 node[
"capsuleRadius"] >> component.capsule_radius;
63 if (node.has_property(
"capsuleHalfHeight"))
65 node[
"capsuleHalfHeight"] >> component.capsule_half_height;
67 if (node.has_property(
"center"))
69 node[
"center"] >> component.center;
71 if (node.has_property(
"friction"))
73 node[
"friction"] >> component.friction;
75 if (node.has_property(
"restitution"))
77 node[
"restitution"] >> component.restitution;
79 if (node.has_property(
"isTrigger"))
81 node[
"isTrigger"] >> component.is_trigger;
85 component.is_trigger =
false;
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:49
Definition collider_component.h:11