diff options
Diffstat (limited to 'modules/bullet/rigid_body_bullet.cpp')
-rw-r--r-- | modules/bullet/rigid_body_bullet.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 433bff8c38..675da1a597 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -346,16 +346,17 @@ void RigidBodyBullet::dispatch_callbacks() { Variant variantBodyDirect = bodyDirect; - Object *obj = ObjectDB::get_instance(force_integration_callback->id); + Object *obj = force_integration_callback->callable.get_object(); if (!obj) { // Remove integration callback - set_force_integration_callback(ObjectID(), StringName()); + set_force_integration_callback(Callable()); } else { const Variant *vp[2] = { &variantBodyDirect, &force_integration_callback->udata }; Callable::CallError responseCallError; int argc = (force_integration_callback->udata.get_type() == Variant::NIL) ? 1 : 2; - obj->call(force_integration_callback->method, vp, argc, responseCallError); + Variant rv; + force_integration_callback->callable.call(vp, argc, rv, responseCallError); } } @@ -371,16 +372,15 @@ void RigidBodyBullet::dispatch_callbacks() { previousActiveState = btBody->isActive(); } -void RigidBodyBullet::set_force_integration_callback(ObjectID p_id, const StringName &p_method, const Variant &p_udata) { +void RigidBodyBullet::set_force_integration_callback(const Callable &p_callable, const Variant &p_udata) { if (force_integration_callback) { memdelete(force_integration_callback); force_integration_callback = nullptr; } - if (p_id.is_valid()) { + if (p_callable.get_object()) { force_integration_callback = memnew(ForceIntegrationCallback); - force_integration_callback->id = p_id; - force_integration_callback->method = p_method; + force_integration_callback->callable = p_callable; force_integration_callback->udata = p_udata; } } |