Added apply_central_impulse to PhysicalBone class

This commit is contained in:
Vitalii Shmorhun 2019-12-12 01:08:11 +02:00 committed by Vitalii Shmorgun
parent 37d164e24e
commit d3b162a9d4
2 changed files with 14 additions and 0 deletions

View file

@ -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);

View file

@ -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();