diff options
author | Juan Linietsky <reduzio@gmail.com> | 2021-08-22 09:31:44 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-22 09:31:44 -0300 |
commit | a73b5fa1124ab91401f965f0bf6fd48407b79c4e (patch) | |
tree | fee311b675144ae3a5fecc58857912ea250b1bb7 /scene/3d | |
parent | 2a5c64f2a188360d09f793c0dbd35e1911b4c073 (diff) | |
parent | 3682978aee06cd5cf26ba462a4e44d352e9e0cd1 (diff) |
Merge pull request #51970 from reduz/implement-gdvirtuals-everywhere
Replace BIND_VMETHOD by new GDVIRTUAL syntax
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 8 | ||||
-rw-r--r-- | scene/3d/physics_body_3d.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 092efc55d7..4c36618c99 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -599,9 +599,9 @@ void RigidBody3D::_direct_state_changed(Object *p_state) { sleeping = state->is_sleeping(); emit_signal(SceneStringNames::get_singleton()->sleeping_state_changed); } - if (get_script_instance()) { - get_script_instance()->call("_integrate_forces", state); - } + + GDVIRTUAL_CALL(_integrate_forces, state); + set_ignore_transform_notification(false); _on_transform_changed(); @@ -1022,7 +1022,7 @@ void RigidBody3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_colliding_bodies"), &RigidBody3D::get_colliding_bodies); - BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectBodyState3D"))); + GDVIRTUAL_BIND(_integrate_forces, "state"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Dynamic,Static,DynamicLocked,Kinematic"), "set_mode", "get_mode"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mass", PROPERTY_HINT_RANGE, "0.01,65535,0.01,exp"), "set_mass", "get_mass"); diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h index 9c40f92f06..26b9a39047 100644 --- a/scene/3d/physics_body_3d.h +++ b/scene/3d/physics_body_3d.h @@ -132,6 +132,8 @@ public: MODE_KINEMATIC, }; + GDVIRTUAL1(_integrate_forces, PhysicsDirectBodyState3D *) + protected: bool can_sleep = true; PhysicsDirectBodyState3D *state = nullptr; |