summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-12 13:11:48 +0200
committerGitHub <noreply@github.com>2017-09-12 13:11:48 +0200
commit50eb62ea6e7d8d04723be222e0aee19b82cb083a (patch)
treee7490b12b6f8096bd8ace2b0f0d430ff64fb0bce
parent98a36c67f4b357a4b6c5ac015926f99738f1d729 (diff)
parent8370f22b4c8012e0c736adf0997791243432f48e (diff)
Merge pull request #11002 from NathanWarden/vehicle_wheel_warning
Added a warning message when a VehicleWheel is not a child of a VehicleBody.
-rw-r--r--scene/3d/vehicle_body.cpp8
-rw-r--r--scene/3d/vehicle_body.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index d6b3206fbf..3518113130 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -102,6 +102,14 @@ void VehicleWheel::_notification(int p_what) {
}
}
+String VehicleWheel::get_configuration_warning() const {
+ if (!Object::cast_to<VehicleBody>(get_parent())) {
+ return TTR("VehicleWheel serves to provide a wheel system to a VehicleBody. Please use it as a child of a VehicleBody.");
+ }
+
+ return String();
+}
+
void VehicleWheel::_update(PhysicsDirectBodyState *s) {
if (m_raycastInfo.m_isInContact)
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index d67209c58f..eb661adb90 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -131,6 +131,8 @@ public:
void set_roll_influence(float p_value);
float get_roll_influence() const;
+ String get_configuration_warning() const;
+
VehicleWheel();
};