diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-07-25 08:25:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-25 08:25:34 +0200 |
commit | f778bd8e694cb9c93cc0e021418f2be362dcdd3c (patch) | |
tree | 69872fb24079f1afd230026238e4763cef9bd30f /scene/3d/physics_body.cpp | |
parent | f8e8ac2c664a12f3af2b9bb545da193d86c75503 (diff) | |
parent | 40c7716586db9182208b51d22e117d099bb4c97d (diff) |
Merge pull request #20404 from TigerCaldwell/master
Ensured consistency between RigidBody, PhysicsDirectBodyState, PhysicsServers and their 2D counterparts
Diffstat (limited to 'scene/3d/physics_body.cpp')
-rw-r--r-- | scene/3d/physics_body.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 7529a0e524..c1b867d114 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -795,6 +795,22 @@ int RigidBody::get_max_contacts_reported() const { return max_contacts_reported; } +void RigidBody::add_central_force(const Vector3 &p_force) { + PhysicsServer::get_singleton()->body_add_central_force(get_rid(), p_force); +} + +void RigidBody::add_force(const Vector3 &p_force, const Vector3 &p_pos) { + PhysicsServer::get_singleton()->body_add_force(get_rid(), p_force, p_pos); +} + +void RigidBody::add_torque(const Vector3 &p_torque) { + PhysicsServer::get_singleton()->body_add_torque(get_rid(), p_torque); +} + +void RigidBody::apply_central_impulse(const Vector3 &p_impulse) { + PhysicsServer::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse); +} + void RigidBody::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) { PhysicsServer::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse); @@ -947,6 +963,12 @@ void RigidBody::_bind_methods() { ClassDB::bind_method(D_METHOD("is_using_continuous_collision_detection"), &RigidBody::is_using_continuous_collision_detection); ClassDB::bind_method(D_METHOD("set_axis_velocity", "axis_velocity"), &RigidBody::set_axis_velocity); + + ClassDB::bind_method(D_METHOD("add_central_force", "force"), &RigidBody::add_central_force); + ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &RigidBody::add_force); + ClassDB::bind_method(D_METHOD("add_torque", "torque"), &RigidBody::add_torque); + + ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &RigidBody::apply_central_impulse); ClassDB::bind_method(D_METHOD("apply_impulse", "position", "impulse"), &RigidBody::apply_impulse); ClassDB::bind_method(D_METHOD("apply_torque_impulse", "impulse"), &RigidBody::apply_torque_impulse); |