PhysicsServer2D and PhysicsServer3D: make body_set_state_sync_callback take a Callable

Prefer Callable to a C-style callback. This is helpful for GDExtension.
This commit is contained in:
Ricardo Buring
2022-09-15 14:15:39 +02:00
parent 4ba934bf3d
commit ff4e72a0bc
21 changed files with 47 additions and 101 deletions

View File

@@ -951,10 +951,10 @@ int GodotPhysicsServer2D::body_get_max_contacts_reported(RID p_body) const {
return body->get_max_contacts_reported();
}
void GodotPhysicsServer2D::body_set_state_sync_callback(RID p_body, void *p_instance, BodyStateCallback p_callback) {
void GodotPhysicsServer2D::body_set_state_sync_callback(RID p_body, const Callable &p_callable) {
GodotBody2D *body = body_owner.get_or_null(p_body);
ERR_FAIL_COND(!body);
body->set_state_sync_callback(p_instance, p_callback);
body->set_state_sync_callback(p_callable);
}
void GodotPhysicsServer2D::body_set_force_integration_callback(RID p_body, const Callable &p_callable, const Variant &p_udata) {