summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-14 17:13:09 +0100
committerGitHub <noreply@github.com>2019-12-14 17:13:09 +0100
commitabab4c0e258184a8bfad54374d86b1c4bf96c5eb (patch)
treed0c304118cbd2673eeb575c05a28eb300b5be4bd /scene
parente0ca3a9ffa370378f327f3699cc70ca0cb4b8438 (diff)
parentd3b162a9d49ab5c537ae46f2afed37fe4511458a (diff)
Merge pull request #34300 from Acvarium/ragdoll-impuls
Added apply_impulse methods to PhysicalBone for ragdolls
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/physics_body.cpp11
-rw-r--r--scene/3d/physics_body.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 6049b6cdb4..dff1b07f3e 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -1554,6 +1554,14 @@ bool PhysicalBone::JointData::_get(const StringName &p_name, Variant &r_ret) con
void PhysicalBone::JointData::_get_property_list(List<PropertyInfo> *p_list) const {
}
+void PhysicalBone::apply_central_impulse(const Vector3 &p_impulse) {
+ PhysicsServer::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
+}
+
+void PhysicalBone::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) {
+ PhysicsServer::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse);
+}
+
bool PhysicalBone::PinJointData::_set(const StringName &p_name, const Variant &p_value, RID j) {
if (JointData::_set(p_name, p_value, j)) {
return true;
@@ -2216,6 +2224,9 @@ void PhysicalBone::_direct_state_changed(Object *p_state) {
}
void PhysicalBone::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &PhysicalBone::apply_central_impulse);
+ ClassDB::bind_method(D_METHOD("apply_impulse", "position", "impulse"), &PhysicalBone::apply_impulse);
+
ClassDB::bind_method(D_METHOD("_direct_state_changed"), &PhysicalBone::_direct_state_changed);
ClassDB::bind_method(D_METHOD("set_joint_type", "joint_type"), &PhysicalBone::set_joint_type);
diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h
index 0967cb9cd5..de1944bdf0 100644
--- a/scene/3d/physics_body.h
+++ b/scene/3d/physics_body.h
@@ -636,6 +636,9 @@ public:
void set_gravity_scale(real_t p_gravity_scale);
real_t get_gravity_scale() const;
+ void apply_central_impulse(const Vector3 &p_impulse);
+ void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse);
+
PhysicalBone();
~PhysicalBone();