diff options
Diffstat (limited to 'scene/3d/vehicle_body.cpp')
-rw-r--r-- | scene/3d/vehicle_body.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 2a41c8f30e..69b938b886 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -81,9 +81,7 @@ void VehicleWheel::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - if (!get_parent()) - return; - VehicleBody *cb = get_parent()->cast_to<VehicleBody>(); + VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent()); if (!cb) return; body = cb; @@ -96,9 +94,7 @@ void VehicleWheel::_notification(int p_what) { } if (p_what == NOTIFICATION_EXIT_TREE) { - if (!get_parent()) - return; - VehicleBody *cb = get_parent()->cast_to<VehicleBody>(); + VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent()); if (!cb) return; cb->wheels.erase(this); @@ -416,7 +412,7 @@ real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) { wheel.m_raycastInfo.m_isInContact = true; if (rr.collider) - wheel.m_raycastInfo.m_groundObject = rr.collider->cast_to<PhysicsBody>(); + wheel.m_raycastInfo.m_groundObject = Object::cast_to<PhysicsBody>(rr.collider); real_t hitDistance = param * raylen; wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelRadius; @@ -804,7 +800,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) { void VehicleBody::_direct_state_changed(Object *p_state) { - PhysicsDirectBodyState *s = p_state->cast_to<PhysicsDirectBodyState>(); + PhysicsDirectBodyState *s = Object::cast_to<PhysicsDirectBodyState>(p_state); set_ignore_transform_notification(true); set_global_transform(s->get_transform()); |