summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-09-29 13:21:15 +0200
committerkobewi <kobewi4e@gmail.com>2022-09-29 13:34:28 +0200
commitc080b9dc05d57cf9363d8fcde42689c943387607 (patch)
tree43b67c3e02d0b3decd5ab934debe807e130011dd /scene/3d
parent6991e9b43d0954018e1a82fa4cb28af42632ae92 (diff)
Fail look_at() if not inside tree
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/node_3d.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index ebf26996dd..12d2e66b41 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -786,6 +786,7 @@ void Node3D::set_identity() {
}
void Node3D::look_at(const Vector3 &p_target, const Vector3 &p_up) {
+ ERR_FAIL_COND_MSG(!is_inside_tree(), "Node not inside tree. Use look_at_from_position() instead.");
Vector3 origin = get_global_transform().origin;
look_at_from_position(origin, p_target, p_up);
}