diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/spatial.cpp | 9 | ||||
-rw-r--r-- | scene/3d/vehicle_body.cpp | 2 | ||||
-rw-r--r-- | scene/3d/vehicle_body.h | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 6a9c655141..920e56130c 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -712,6 +712,15 @@ void Spatial::look_at(const Vector3& p_target, const Vector3& p_up_normal) { Transform lookat; lookat.origin=get_global_transform().origin; + if (lookat.origin==p_target) { + ERR_EXPLAIN("Node origin and target are in the same position, look_at() failed"); + ERR_FAIL(); + } + + if (p_up_normal.cross(p_target-lookat.origin)==Vector3()) { + ERR_EXPLAIN("Up vector and direction between node origin and target are aligned, look_at() failed"); + ERR_FAIL(); + } lookat=lookat.looking_at(p_target,p_up_normal); set_global_transform(lookat); } diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index e35ba11e84..7d134a070e 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -990,7 +990,7 @@ float VehicleBody::get_steering() const{ return m_steeringValue; } -Vector3 VehicleBody::get_linear_velocity() +Vector3 VehicleBody::get_linear_velocity() const { return linear_velocity; } diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h index b6ad88f15e..31c61ff99d 100644 --- a/scene/3d/vehicle_body.h +++ b/scene/3d/vehicle_body.h @@ -178,7 +178,7 @@ public: void set_steering(float p_steering); float get_steering() const; - Vector3 get_linear_velocity(); + Vector3 get_linear_velocity() const; VehicleBody(); }; |