mirror of
https://github.com/godotengine/godot.git
synced 2024-12-02 00:52:50 +00:00
Merge pull request #16060 from sdfgeoff/apply_torque
Exposed apply_torque_impulse to gdscript
This commit is contained in:
commit
a41c45c335
@ -35,6 +35,15 @@
|
||||
Apply a positioned impulse (which will be affected by the body mass and shape). This is the equivalent of hitting a billiard ball with a cue: a force that is applied once, and only once. Both the impulse and the position are in global coordinates, and the position is relative to the object's origin.
|
||||
</description>
|
||||
</method>
|
||||
<method name="apply_torque_impulse">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="1" name="impulse" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Apply a torque impulse (which will be affected by the body mass and shape). This will rotate the body around the passed in vector.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_colliding_bodies" qualifiers="const">
|
||||
<return type="Array">
|
||||
</return>
|
||||
|
@ -694,6 +694,10 @@ void RigidBody::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) {
|
||||
PhysicsServer::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse);
|
||||
}
|
||||
|
||||
void RigidBody::apply_torque_impulse(const Vector3 &p_impulse) {
|
||||
PhysicsServer::get_singleton()->body_apply_torque_impulse(get_rid(), p_impulse);
|
||||
}
|
||||
|
||||
void RigidBody::set_use_continuous_collision_detection(bool p_enable) {
|
||||
|
||||
ccd = p_enable;
|
||||
@ -833,6 +837,7 @@ void RigidBody::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_axis_velocity", "axis_velocity"), &RigidBody::set_axis_velocity);
|
||||
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);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_sleeping", "sleeping"), &RigidBody::set_sleeping);
|
||||
ClassDB::bind_method(D_METHOD("is_sleeping"), &RigidBody::is_sleeping);
|
||||
|
@ -242,6 +242,7 @@ public:
|
||||
Array get_colliding_bodies() const;
|
||||
|
||||
void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse);
|
||||
void apply_torque_impulse(const Vector3 &p_impulse);
|
||||
|
||||
virtual String get_configuration_warning() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user