25class [[ToastNode, Color(
"Red")]] TOAST_API Node3D :
public Node {
26 friend class INodeOwner;
30 [[
Reflect, Unit(
"m")]]
alignas(16)
mutable glm::vec3 position = glm::vec3(0.0f);
31 [[
Reflect, Unit(
"°")]]
alignas(16)
mutable glm::quat rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
32 [[
Reflect]]
alignas(16)
mutable glm::vec3 scale = glm::vec3(1.0f);
34 [[
Reflect, NoSerialize, Unit(
"m"), Group(
"World Transform")]]
alignas(16)
mutable glm::vec3 world_position = glm::vec3(0.0f);
35 [[
Reflect, NoSerialize, Unit(
"°"), Group(
"World Transform")]]
alignas(16)
mutable glm::quat world_rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
36 [[
Reflect, NoSerialize, Group(
"World Transform")]]
alignas(16)
mutable glm::vec3 world_scale = glm::vec3(1.0f);
48 glm::vec3 dir, glm::vec3 offset = glm::vec3(0.0f),
float max_distance = -1.0f,
bool ignore_self =
true,
49 const std::vector<int>& layers = std::vector<int> {}
50 )
const -> std::optional<physics::RayHit>;
58 glm::vec3 dir, glm::vec3 offset = glm::vec3(0.0f),
float max_distance = -1.0f,
int max_hits = -1,
bool ignore_self =
true,
59 const std::vector<int>& layers = std::vector<int> {}
60 )
const -> std::vector<physics::RayHit>;
70 glm::vec3 from, glm::vec3 to,
int max_hits = -1,
bool ignore_self =
true,
71 const std::vector<int>& layers = std::vector<int> {}
72 )
const -> std::vector<physics::RayHit>;
79 void lookAt(glm::vec3 target, glm::vec3
up = {0.0f, 0.0f, 1.0f});
91 auto up()
const -> glm::vec3;
97 auto forward()
const -> glm::vec3;
99 void syncTransform()
const;
101 void syncWorldTransform()
const;
103 void refreshTransformParent();
106 auto getTransform()
const noexcept ->
const glm::mat4&;
109 auto getWorldTransform()
const noexcept ->
const glm::mat4&;
111 virtual void onEditorTransformChanged() { }
113 static inline const glm::vec3 world_up = {0.0f, 0.0f, 1.0f};
121 mutable bool m_dirty_world =
true;
124 alignas(16)
mutable glm::vec3 m_previous_position = glm::vec3(0.0f);
125 alignas(16)
mutable glm::quat m_previous_rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
126 alignas(16)
mutable glm::vec3 m_previous_scale = glm::vec3(1.0f);
127 alignas(16)
mutable glm::vec3 m_previous_world_position = glm::vec3(0.0f);
128 alignas(16)
mutable glm::quat m_previous_world_rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
129 alignas(16)
mutable glm::vec3 m_previous_world_scale = glm::vec3(1.0f);
131 mutable glm::mat4 m_transform = glm::mat4(1.0f);
132 mutable glm::mat4 m_world_transform = glm::mat4(1.0f);
auto raycast(glm::vec3 dir, glm::vec3 offset=glm::vec3(0.0f), float max_distance=-1.0f, bool ignore_self=true, const std::vector< int > &layers=std::vector< int > {}) const -> std::optional< physics::RayHit >
The nearest thing a ray from this node hits.
Definition node_3d.cpp:29
void lookAtZ(glm::vec3 target)
lookAt() constrained to the XY plane; the node faces the target with no roll
Definition node_3d.cpp:89
auto raymulticast(glm::vec3 dir, glm::vec3 offset=glm::vec3(0.0f), float max_distance=-1.0f, int max_hits=-1, bool ignore_self=true, const std::vector< int > &layers=std::vector< int > {}) const -> std::vector< physics::RayHit >
Up to max_hits things collisions.
Definition node_3d.cpp:40
void lookAt(glm::vec3 target, glm::vec3 up={0.0f, 0.0f, 1.0f})
Orients the node so its forward axis points at a world-space target.
Definition node_3d.cpp:60
auto linecast(glm::vec3 from, glm::vec3 to, int max_hits=-1, bool ignore_self=true, const std::vector< int > &layers=std::vector< int > {}) const -> std::vector< physics::RayHit >
Everything on the line between two points, nearest to from first.
Definition node_3d.cpp:53