Merge pull request #20404 from TigerCaldwell/master
Ensured consistency between RigidBody, PhysicsDirectBodyState, PhysicsServers and their 2D counterparts
This commit is contained in:
commit
f778bd8e69
@ -721,6 +721,34 @@ Vector3 BulletPhysicsServer::body_get_applied_torque(RID p_body) const {
|
||||
return body->get_applied_torque();
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::body_add_central_force(RID p_body, const Vector3 &p_force) {
|
||||
RigidBodyBullet *body = rigid_body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->apply_central_force(p_force);
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos) {
|
||||
RigidBodyBullet *body = rigid_body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->apply_force(p_force, p_pos);
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::body_add_torque(RID p_body, const Vector3 &p_torque) {
|
||||
RigidBodyBullet *body = rigid_body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->apply_torque(p_torque);
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) {
|
||||
RigidBodyBullet *body = rigid_body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->apply_central_impulse(p_impulse);
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse) {
|
||||
RigidBodyBullet *body = rigid_body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
@ -228,6 +228,11 @@ public:
|
||||
virtual void body_set_applied_torque(RID p_body, const Vector3 &p_torque);
|
||||
virtual Vector3 body_get_applied_torque(RID p_body) const;
|
||||
|
||||
virtual void body_add_central_force(RID p_body, const Vector3 &p_force);
|
||||
virtual void body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos);
|
||||
virtual void body_add_torque(RID p_body, const Vector3 &p_torque);
|
||||
|
||||
virtual void body_apply_central_impulse(RID p_body, const Vector3 &p_impulse);
|
||||
virtual void body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse);
|
||||
virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse);
|
||||
virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity);
|
||||
|
@ -126,6 +126,10 @@ void BulletPhysicsDirectBodyState::add_torque(const Vector3 &p_torque) {
|
||||
body->apply_torque(p_torque);
|
||||
}
|
||||
|
||||
void BulletPhysicsDirectBodyState::apply_central_impulse(const Vector3 &p_j) {
|
||||
body->apply_central_impulse(p_j);
|
||||
}
|
||||
|
||||
void BulletPhysicsDirectBodyState::apply_impulse(const Vector3 &p_pos, const Vector3 &p_j) {
|
||||
body->apply_impulse(p_pos, p_j);
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ public:
|
||||
virtual void add_central_force(const Vector3 &p_force);
|
||||
virtual void add_force(const Vector3 &p_force, const Vector3 &p_pos);
|
||||
virtual void add_torque(const Vector3 &p_torque);
|
||||
virtual void apply_central_impulse(const Vector3 &p_impulse);
|
||||
virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_j);
|
||||
virtual void apply_torque_impulse(const Vector3 &p_j);
|
||||
|
||||
|
@ -800,11 +800,19 @@ int RigidBody2D::get_max_contacts_reported() const {
|
||||
return max_contacts_reported;
|
||||
}
|
||||
|
||||
void RigidBody2D::apply_central_impulse(const Vector2 &p_impulse) {
|
||||
Physics2DServer::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
|
||||
}
|
||||
|
||||
void RigidBody2D::apply_impulse(const Vector2 &p_offset, const Vector2 &p_impulse) {
|
||||
|
||||
Physics2DServer::get_singleton()->body_apply_impulse(get_rid(), p_offset, p_impulse);
|
||||
}
|
||||
|
||||
void RigidBody2D::apply_torque_impulse(float p_torque) {
|
||||
Physics2DServer::get_singleton()->body_apply_torque_impulse(get_rid(), p_torque);
|
||||
}
|
||||
|
||||
void RigidBody2D::set_applied_force(const Vector2 &p_force) {
|
||||
|
||||
Physics2DServer::get_singleton()->body_set_applied_force(get_rid(), p_force);
|
||||
@ -825,11 +833,19 @@ float RigidBody2D::get_applied_torque() const {
|
||||
return Physics2DServer::get_singleton()->body_get_applied_torque(get_rid());
|
||||
};
|
||||
|
||||
void RigidBody2D::add_central_force(const Vector2 &p_force) {
|
||||
Physics2DServer::get_singleton()->body_add_central_force(get_rid(), p_force);
|
||||
}
|
||||
|
||||
void RigidBody2D::add_force(const Vector2 &p_offset, const Vector2 &p_force) {
|
||||
|
||||
Physics2DServer::get_singleton()->body_add_force(get_rid(), p_offset, p_force);
|
||||
}
|
||||
|
||||
void RigidBody2D::add_torque(const float p_torque) {
|
||||
Physics2DServer::get_singleton()->body_add_torque(get_rid(), p_torque);
|
||||
}
|
||||
|
||||
void RigidBody2D::set_continuous_collision_detection_mode(CCDMode p_mode) {
|
||||
|
||||
ccd_mode = p_mode;
|
||||
@ -986,7 +1002,9 @@ void RigidBody2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_continuous_collision_detection_mode"), &RigidBody2D::get_continuous_collision_detection_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_axis_velocity", "axis_velocity"), &RigidBody2D::set_axis_velocity);
|
||||
ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &RigidBody2D::apply_central_impulse);
|
||||
ClassDB::bind_method(D_METHOD("apply_impulse", "offset", "impulse"), &RigidBody2D::apply_impulse);
|
||||
ClassDB::bind_method(D_METHOD("apply_torque_impulse", "torque"), &RigidBody2D::apply_torque_impulse);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_applied_force", "force"), &RigidBody2D::set_applied_force);
|
||||
ClassDB::bind_method(D_METHOD("get_applied_force"), &RigidBody2D::get_applied_force);
|
||||
@ -994,7 +1012,9 @@ void RigidBody2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_applied_torque", "torque"), &RigidBody2D::set_applied_torque);
|
||||
ClassDB::bind_method(D_METHOD("get_applied_torque"), &RigidBody2D::get_applied_torque);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_central_force", "force"), &RigidBody2D::add_central_force);
|
||||
ClassDB::bind_method(D_METHOD("add_force", "offset", "force"), &RigidBody2D::add_force);
|
||||
ClassDB::bind_method(D_METHOD("add_torque", "torque"), &RigidBody2D::add_torque);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_sleeping", "sleeping"), &RigidBody2D::set_sleeping);
|
||||
ClassDB::bind_method(D_METHOD("is_sleeping"), &RigidBody2D::is_sleeping);
|
||||
|
@ -256,7 +256,9 @@ public:
|
||||
void set_continuous_collision_detection_mode(CCDMode p_mode);
|
||||
CCDMode get_continuous_collision_detection_mode() const;
|
||||
|
||||
void apply_central_impulse(const Vector2 &p_impulse);
|
||||
void apply_impulse(const Vector2 &p_offset, const Vector2 &p_impulse);
|
||||
void apply_torque_impulse(float p_torque);
|
||||
|
||||
void set_applied_force(const Vector2 &p_force);
|
||||
Vector2 get_applied_force() const;
|
||||
@ -264,7 +266,9 @@ public:
|
||||
void set_applied_torque(const float p_torque);
|
||||
float get_applied_torque() const;
|
||||
|
||||
void add_central_force(const Vector2 &p_force);
|
||||
void add_force(const Vector2 &p_offset, const Vector2 &p_force);
|
||||
void add_torque(float p_torque);
|
||||
|
||||
Array get_colliding_bodies() const; //function for script
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -254,6 +254,11 @@ public:
|
||||
|
||||
Array get_colliding_bodies() const;
|
||||
|
||||
void add_central_force(const Vector3 &p_force);
|
||||
void add_force(const Vector3 &p_force, const Vector3 &p_pos);
|
||||
void add_torque(const Vector3 &p_torque);
|
||||
|
||||
void apply_central_impulse(const Vector3 &p_impulse);
|
||||
void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse);
|
||||
void apply_torque_impulse(const Vector3 &p_impulse);
|
||||
|
||||
|
@ -219,6 +219,10 @@ public:
|
||||
_FORCE_INLINE_ const Vector3 &get_biased_linear_velocity() const { return biased_linear_velocity; }
|
||||
_FORCE_INLINE_ const Vector3 &get_biased_angular_velocity() const { return biased_angular_velocity; }
|
||||
|
||||
_FORCE_INLINE_ void apply_central_impulse(const Vector3 &p_j) {
|
||||
linear_velocity += p_j * _inv_mass;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void apply_impulse(const Vector3 &p_pos, const Vector3 &p_j) {
|
||||
|
||||
linear_velocity += p_j * _inv_mass;
|
||||
@ -421,6 +425,7 @@ public:
|
||||
virtual void add_central_force(const Vector3 &p_force) { body->add_central_force(p_force); }
|
||||
virtual void add_force(const Vector3 &p_force, const Vector3 &p_pos) { body->add_force(p_force, p_pos); }
|
||||
virtual void add_torque(const Vector3 &p_torque) { body->add_torque(p_torque); }
|
||||
virtual void apply_central_impulse(const Vector3 &p_j) { body->apply_central_impulse(p_j); }
|
||||
virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_j) { body->apply_impulse(p_pos, p_j); }
|
||||
virtual void apply_torque_impulse(const Vector3 &p_j) { body->apply_torque_impulse(p_j); }
|
||||
|
||||
|
@ -777,6 +777,40 @@ Vector3 PhysicsServerSW::body_get_applied_torque(RID p_body) const {
|
||||
return body->get_applied_torque();
|
||||
};
|
||||
|
||||
void PhysicsServerSW::body_add_central_force(RID p_body, const Vector3 &p_force) {
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->add_central_force(p_force);
|
||||
body->wakeup();
|
||||
}
|
||||
|
||||
void PhysicsServerSW::body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos) {
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->add_force(p_force, p_pos);
|
||||
body->wakeup();
|
||||
};
|
||||
|
||||
void PhysicsServerSW::body_add_torque(RID p_body, const Vector3 &p_torque) {
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->add_torque(p_torque);
|
||||
body->wakeup();
|
||||
};
|
||||
|
||||
void PhysicsServerSW::body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) {
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
_update_shapes();
|
||||
|
||||
body->apply_central_impulse(p_impulse);
|
||||
body->wakeup();
|
||||
}
|
||||
|
||||
void PhysicsServerSW::body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse) {
|
||||
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
|
@ -204,6 +204,11 @@ public:
|
||||
virtual void body_set_applied_torque(RID p_body, const Vector3 &p_torque);
|
||||
virtual Vector3 body_get_applied_torque(RID p_body) const;
|
||||
|
||||
virtual void body_add_central_force(RID p_body, const Vector3 &p_force);
|
||||
virtual void body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos);
|
||||
virtual void body_add_torque(RID p_body, const Vector3 &p_torque);
|
||||
|
||||
virtual void body_apply_central_impulse(RID p_body, const Vector3 &p_impulse);
|
||||
virtual void body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse);
|
||||
virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse);
|
||||
virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity);
|
||||
|
@ -201,12 +201,20 @@ public:
|
||||
_FORCE_INLINE_ void set_biased_angular_velocity(real_t p_velocity) { biased_angular_velocity = p_velocity; }
|
||||
_FORCE_INLINE_ real_t get_biased_angular_velocity() const { return biased_angular_velocity; }
|
||||
|
||||
_FORCE_INLINE_ void apply_central_impulse(const Vector2 &p_impulse) {
|
||||
linear_velocity += p_impulse * _inv_mass;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void apply_impulse(const Vector2 &p_offset, const Vector2 &p_impulse) {
|
||||
|
||||
linear_velocity += p_impulse * _inv_mass;
|
||||
angular_velocity += _inv_inertia * p_offset.cross(p_impulse);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void apply_torque_impulse(real_t p_torque) {
|
||||
angular_velocity += _inv_inertia * p_torque;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void apply_bias_impulse(const Vector2 &p_pos, const Vector2 &p_j) {
|
||||
|
||||
biased_linear_velocity += p_j * _inv_mass;
|
||||
@ -237,12 +245,20 @@ public:
|
||||
void set_applied_torque(real_t p_torque) { applied_torque = p_torque; }
|
||||
real_t get_applied_torque() const { return applied_torque; }
|
||||
|
||||
_FORCE_INLINE_ void add_force(const Vector2 &p_force, const Vector2 &p_offset) {
|
||||
_FORCE_INLINE_ void add_central_force(const Vector2 &p_force) {
|
||||
applied_force += p_force;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void add_force(const Vector2 &p_offset, const Vector2 &p_force) {
|
||||
|
||||
applied_force += p_force;
|
||||
applied_torque += p_offset.cross(p_force);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void add_torque(real_t p_torque) {
|
||||
applied_torque += p_torque;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_continuous_collision_detection_mode(Physics2DServer::CCDMode p_mode) { continuous_cd_mode = p_mode; }
|
||||
_FORCE_INLINE_ Physics2DServer::CCDMode get_continuous_collision_detection_mode() const { return continuous_cd_mode; }
|
||||
|
||||
@ -357,6 +373,13 @@ public:
|
||||
virtual void set_transform(const Transform2D &p_transform) { body->set_state(Physics2DServer::BODY_STATE_TRANSFORM, p_transform); }
|
||||
virtual Transform2D get_transform() const { return body->get_transform(); }
|
||||
|
||||
virtual void add_central_force(const Vector2 &p_force) { body->add_central_force(p_force); }
|
||||
virtual void add_force(const Vector2 &p_offset, const Vector2 &p_force) { body->add_force(p_offset, p_force); }
|
||||
virtual void add_torque(real_t p_torque) { body->add_torque(p_torque); }
|
||||
virtual void apply_central_impulse(const Vector2 &p_impulse) { body->apply_central_impulse(p_impulse); }
|
||||
virtual void apply_impulse(const Vector2 &p_offset, const Vector2 &p_force) { body->apply_impulse(p_offset, p_force); }
|
||||
virtual void apply_torque_impulse(real_t p_torque) { body->apply_torque_impulse(p_torque); }
|
||||
|
||||
virtual void set_sleep_state(bool p_enable) { body->set_active(!p_enable); }
|
||||
virtual bool is_sleeping() const { return !body->is_active(); }
|
||||
|
||||
|
@ -854,6 +854,21 @@ real_t Physics2DServerSW::body_get_applied_torque(RID p_body) const {
|
||||
return body->get_applied_torque();
|
||||
};
|
||||
|
||||
void Physics2DServerSW::body_apply_central_impulse(RID p_body, const Vector2 &p_impulse) {
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->apply_central_impulse(p_impulse);
|
||||
body->wakeup();
|
||||
}
|
||||
|
||||
void Physics2DServerSW::body_apply_torque_impulse(RID p_body, real_t p_torque) {
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->apply_torque_impulse(p_torque);
|
||||
}
|
||||
|
||||
void Physics2DServerSW::body_apply_impulse(RID p_body, const Vector2 &p_pos, const Vector2 &p_impulse) {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
@ -863,12 +878,28 @@ void Physics2DServerSW::body_apply_impulse(RID p_body, const Vector2 &p_pos, con
|
||||
body->wakeup();
|
||||
};
|
||||
|
||||
void Physics2DServerSW::body_add_central_force(RID p_body, const Vector2 &p_force) {
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->add_central_force(p_force);
|
||||
body->wakeup();
|
||||
};
|
||||
|
||||
void Physics2DServerSW::body_add_force(RID p_body, const Vector2 &p_offset, const Vector2 &p_force) {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->add_force(p_force, p_offset);
|
||||
body->add_force(p_offset, p_force);
|
||||
body->wakeup();
|
||||
};
|
||||
|
||||
void Physics2DServerSW::body_add_torque(RID p_body, real_t p_torque) {
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->add_torque(p_torque);
|
||||
body->wakeup();
|
||||
};
|
||||
|
||||
|
@ -213,8 +213,12 @@ public:
|
||||
virtual void body_set_applied_torque(RID p_body, real_t p_torque);
|
||||
virtual real_t body_get_applied_torque(RID p_body) const;
|
||||
|
||||
virtual void body_add_central_force(RID p_body, const Vector2 &p_force);
|
||||
virtual void body_add_force(RID p_body, const Vector2 &p_offset, const Vector2 &p_force);
|
||||
virtual void body_add_torque(RID p_body, real_t p_torque);
|
||||
|
||||
virtual void body_apply_central_impulse(RID p_body, const Vector2 &p_impulse);
|
||||
virtual void body_apply_torque_impulse(RID p_body, real_t p_torque);
|
||||
virtual void body_apply_impulse(RID p_body, const Vector2 &p_pos, const Vector2 &p_impulse);
|
||||
virtual void body_set_axis_velocity(RID p_body, const Vector2 &p_axis_velocity);
|
||||
|
||||
|
@ -223,7 +223,11 @@ public:
|
||||
FUNC2(body_set_applied_torque, RID, real_t);
|
||||
FUNC1RC(real_t, body_get_applied_torque, RID);
|
||||
|
||||
FUNC2(body_add_central_force, RID, const Vector2 &);
|
||||
FUNC3(body_add_force, RID, const Vector2 &, const Vector2 &);
|
||||
FUNC2(body_add_torque, RID, real_t);
|
||||
FUNC2(body_apply_central_impulse, RID, const Vector2 &);
|
||||
FUNC2(body_apply_torque_impulse, RID, real_t);
|
||||
FUNC3(body_apply_impulse, RID, const Vector2 &, const Vector2 &);
|
||||
FUNC2(body_set_axis_velocity, RID, const Vector2 &);
|
||||
|
||||
|
@ -91,6 +91,13 @@ void Physics2DDirectBodyState::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "transform"), &Physics2DDirectBodyState::set_transform);
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &Physics2DDirectBodyState::get_transform);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_central_force", "force"), &Physics2DDirectBodyState::add_central_force);
|
||||
ClassDB::bind_method(D_METHOD("add_force", "offset", "force"), &Physics2DDirectBodyState::add_force);
|
||||
ClassDB::bind_method(D_METHOD("add_torque", "torque"), &Physics2DDirectBodyState::add_torque);
|
||||
ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &Physics2DDirectBodyState::apply_central_impulse);
|
||||
ClassDB::bind_method(D_METHOD("apply_torque_impulse", "impulse"), &Physics2DDirectBodyState::apply_torque_impulse);
|
||||
ClassDB::bind_method(D_METHOD("apply_impulse", "offset", "impulse"), &Physics2DDirectBodyState::apply_impulse);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_sleep_state", "enabled"), &Physics2DDirectBodyState::set_sleep_state);
|
||||
ClassDB::bind_method(D_METHOD("is_sleeping"), &Physics2DDirectBodyState::is_sleeping);
|
||||
|
||||
@ -585,8 +592,12 @@ void Physics2DServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("body_set_state", "body", "state", "value"), &Physics2DServer::body_set_state);
|
||||
ClassDB::bind_method(D_METHOD("body_get_state", "body", "state"), &Physics2DServer::body_get_state);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("body_apply_central_impulse", "body", "impulse"), &Physics2DServer::body_apply_central_impulse);
|
||||
ClassDB::bind_method(D_METHOD("body_apply_torque_impulse", "body", "impulse"), &Physics2DServer::body_apply_torque_impulse);
|
||||
ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "position", "impulse"), &Physics2DServer::body_apply_impulse);
|
||||
ClassDB::bind_method(D_METHOD("body_add_central_force", "force"), &Physics2DServer::body_add_central_force);
|
||||
ClassDB::bind_method(D_METHOD("body_add_force", "body", "offset", "force"), &Physics2DServer::body_add_force);
|
||||
ClassDB::bind_method(D_METHOD("body_add_torque", "body", "torque"), &Physics2DServer::body_add_torque);
|
||||
ClassDB::bind_method(D_METHOD("body_set_axis_velocity", "body", "axis_velocity"), &Physics2DServer::body_set_axis_velocity);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("body_add_collision_exception", "body", "excepted_body"), &Physics2DServer::body_add_collision_exception);
|
||||
|
@ -61,6 +61,13 @@ public:
|
||||
virtual void set_transform(const Transform2D &p_transform) = 0;
|
||||
virtual Transform2D get_transform() const = 0;
|
||||
|
||||
virtual void add_central_force(const Vector2 &p_force) = 0;
|
||||
virtual void add_force(const Vector2 &p_offset, const Vector2 &p_force) = 0;
|
||||
virtual void add_torque(real_t p_torque) = 0;
|
||||
virtual void apply_central_impulse(const Vector2 &p_impulse) = 0;
|
||||
virtual void apply_torque_impulse(real_t p_torque) = 0;
|
||||
virtual void apply_impulse(const Vector2 &p_offset, const Vector2 &p_impulse) = 0;
|
||||
|
||||
virtual void set_sleep_state(bool p_enable) = 0;
|
||||
virtual bool is_sleeping() const = 0;
|
||||
|
||||
@ -448,8 +455,12 @@ public:
|
||||
virtual void body_set_applied_torque(RID p_body, float p_torque) = 0;
|
||||
virtual float body_get_applied_torque(RID p_body) const = 0;
|
||||
|
||||
virtual void body_add_central_force(RID p_body, const Vector2 &p_force) = 0;
|
||||
virtual void body_add_force(RID p_body, const Vector2 &p_offset, const Vector2 &p_force) = 0;
|
||||
virtual void body_add_torque(RID p_body, float p_torque) = 0;
|
||||
|
||||
virtual void body_apply_central_impulse(RID p_body, const Vector2 &p_impulse) = 0;
|
||||
virtual void body_apply_torque_impulse(RID p_body, float p_torque) = 0;
|
||||
virtual void body_apply_impulse(RID p_body, const Vector2 &p_offset, const Vector2 &p_impulse) = 0;
|
||||
virtual void body_set_axis_velocity(RID p_body, const Vector2 &p_axis_velocity) = 0;
|
||||
|
||||
|
@ -95,6 +95,7 @@ void PhysicsDirectBodyState::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("add_central_force", "force"), &PhysicsDirectBodyState::add_central_force);
|
||||
ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &PhysicsDirectBodyState::add_force);
|
||||
ClassDB::bind_method(D_METHOD("add_torque", "torque"), &PhysicsDirectBodyState::add_torque);
|
||||
ClassDB::bind_method(D_METHOD("apply_central_impulse", "j"), &PhysicsDirectBodyState::apply_central_impulse);
|
||||
ClassDB::bind_method(D_METHOD("apply_impulse", "position", "j"), &PhysicsDirectBodyState::apply_impulse);
|
||||
ClassDB::bind_method(D_METHOD("apply_torque_impulse", "j"), &PhysicsDirectBodyState::apply_torque_impulse);
|
||||
|
||||
@ -495,6 +496,11 @@ void PhysicsServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("body_set_state", "body", "state", "value"), &PhysicsServer::body_set_state);
|
||||
ClassDB::bind_method(D_METHOD("body_get_state", "body", "state"), &PhysicsServer::body_get_state);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("body_add_central_force", "body", "force"), &PhysicsServer::body_add_central_force);
|
||||
ClassDB::bind_method(D_METHOD("body_add_force", "body", "force", "position"), &PhysicsServer::body_add_force);
|
||||
ClassDB::bind_method(D_METHOD("body_add_torque", "body", "torque"), &PhysicsServer::body_add_torque);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("body_apply_central_impulse", "body", "impulse"), &PhysicsServer::body_apply_central_impulse);
|
||||
ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "position", "impulse"), &PhysicsServer::body_apply_impulse);
|
||||
ClassDB::bind_method(D_METHOD("body_apply_torque_impulse", "body", "impulse"), &PhysicsServer::body_apply_torque_impulse);
|
||||
ClassDB::bind_method(D_METHOD("body_set_axis_velocity", "body", "axis_velocity"), &PhysicsServer::body_set_axis_velocity);
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
virtual void add_central_force(const Vector3 &p_force) = 0;
|
||||
virtual void add_force(const Vector3 &p_force, const Vector3 &p_pos) = 0;
|
||||
virtual void add_torque(const Vector3 &p_torque) = 0;
|
||||
virtual void apply_central_impulse(const Vector3 &p_j) = 0;
|
||||
virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_j) = 0;
|
||||
virtual void apply_torque_impulse(const Vector3 &p_j) = 0;
|
||||
|
||||
@ -434,6 +435,11 @@ public:
|
||||
virtual void body_set_applied_torque(RID p_body, const Vector3 &p_torque) = 0;
|
||||
virtual Vector3 body_get_applied_torque(RID p_body) const = 0;
|
||||
|
||||
virtual void body_add_central_force(RID p_body, const Vector3 &p_force) = 0;
|
||||
virtual void body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos) = 0;
|
||||
virtual void body_add_torque(RID p_body, const Vector3 &p_torque) = 0;
|
||||
|
||||
virtual void body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) = 0;
|
||||
virtual void body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse) = 0;
|
||||
virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse) = 0;
|
||||
virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user