3#include "pixelbullet/serialization/node.h"
13 float horizontal_fov_degrees = 90.0f;
14 float eye_height = 1.6f;
15 float lose_sight_grace_seconds = 0.35f;
16 float chase_stop_distance = 0.75f;
23 node[
"enabled"] << component.enabled;
24 node[
"range"] << component.range;
25 node[
"horizontalFovDegrees"] << component.horizontal_fov_degrees;
26 node[
"eyeHeight"] << component.eye_height;
27 node[
"loseSightGraceSeconds"] << component.lose_sight_grace_seconds;
28 node[
"chaseStopDistance"] << component.chase_stop_distance;
32inline const Node& operator>>(
const Node& node, PerceptionSensorComponent& component)
34 if (node.HasProperty(
"enabled"))
36 node[
"enabled"] >> component.enabled;
40 component.enabled =
true;
43 if (node.HasProperty(
"range"))
45 node[
"range"] >> component.range;
49 component.range = 8.0f;
52 if (node.HasProperty(
"horizontalFovDegrees"))
54 node[
"horizontalFovDegrees"] >> component.horizontal_fov_degrees;
58 component.horizontal_fov_degrees = 90.0f;
61 if (node.HasProperty(
"eyeHeight"))
63 node[
"eyeHeight"] >> component.eye_height;
67 component.eye_height = 1.6f;
70 if (node.HasProperty(
"loseSightGraceSeconds"))
72 node[
"loseSightGraceSeconds"] >> component.lose_sight_grace_seconds;
76 component.lose_sight_grace_seconds = 0.35f;
79 if (node.HasProperty(
"chaseStopDistance"))
81 node[
"chaseStopDistance"] >> component.chase_stop_distance;
85 component.chase_stop_distance = 0.75f;
88 component.range = std::max(component.range, 0.0001f);
89 component.horizontal_fov_degrees = std::clamp(component.horizontal_fov_degrees, 1.0f, 359.0f);
90 component.eye_height = std::max(component.eye_height, 0.0f);
91 component.lose_sight_grace_seconds = std::max(component.lose_sight_grace_seconds, 0.0f);
92 component.chase_stop_distance = std::max(component.chase_stop_distance, 0.0f);
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:45
Definition perception_sensor_component.h:10