RigidBody2D: add and bind get/set_applied_torque.

This commit is contained in:
Josh Grams 2016-04-20 19:49:35 -04:00
parent c0ec7e933a
commit dbabe4c07c
3 changed files with 72 additions and 0 deletions

View File

@ -2900,6 +2900,12 @@
</method>
</methods>
<signals>
<signal name="animation_started">
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</signal>
<signal name="animation_changed">
<argument index="0" name="old_name" type="String">
</argument>
@ -13887,6 +13893,12 @@ Returns an empty String "" at the end of the list.
<description>
</description>
</method>
<method name="get_connection" qualifiers="const">
<return type="StreamPeer">
</return>
<description>
</description>
</method>
<method name="request">
<return type="int">
</return>
@ -19118,6 +19130,14 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
Set the mesh of the item.
</description>
</method>
<method name="set_item_navmesh">
<argument index="0" name="id" type="int">
</argument>
<argument index="1" name="navmesh" type="NavigationMesh">
</argument>
<description>
</description>
</method>
<method name="set_item_shape">
<argument index="0" name="id" type="int">
</argument>
@ -19144,6 +19164,14 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
Return the mesh of the item.
</description>
</method>
<method name="get_item_navmesh" qualifiers="const">
<return type="NavigationMesh">
</return>
<argument index="0" name="id" type="int">
</argument>
<description>
</description>
</method>
<method name="get_item_shape" qualifiers="const">
<return type="Shape">
</return>
@ -30206,6 +30234,18 @@ This method controls whether the position between two cached points is interpola
Return the applied force vector.
</description>
</method>
<method name="set_applied_torque">
<argument index="0" name="torque" type="float">
</argument>
<description>
</description>
</method>
<method name="get_applied_torque" qualifiers="const">
<return type="float">
</return>
<description>
</description>
</method>
<method name="set_sleeping">
<argument index="0" name="sleeping" type="bool">
</argument>
@ -36069,6 +36109,22 @@ This method controls whether the position between two cached points is interpola
<description>
</description>
</method>
<method name="add_triangle_fan">
<argument index="0" name="vertexes" type="Vector3Array">
</argument>
<argument index="1" name="uvs" type="Vector2Array" default="[Vector2Array]">
</argument>
<argument index="2" name="colors" type="ColorArray" default="ColorArray([ColorArray])">
</argument>
<argument index="3" name="uv2s" type="Vector2Array" default="[Vector2Array]">
</argument>
<argument index="4" name="normals" type="Vector3Array" default="Vector3Array()">
</argument>
<argument index="5" name="tangents" type="Array" default="Array()">
</argument>
<description>
</description>
</method>
<method name="set_material">
<argument index="0" name="material" type="Material">
</argument>

View File

@ -782,6 +782,16 @@ Vector2 RigidBody2D::get_applied_force() const {
return Physics2DServer::get_singleton()->body_get_applied_force(get_rid());
};
void RigidBody2D::set_applied_torque(const float p_torque) {
Physics2DServer::get_singleton()->body_set_applied_torque(get_rid(), p_torque);
};
float RigidBody2D::get_applied_torque() const {
return Physics2DServer::get_singleton()->body_get_applied_torque(get_rid());
};
void RigidBody2D::set_continuous_collision_detection_mode(CCDMode p_mode) {
@ -900,6 +910,9 @@ void RigidBody2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_applied_force","force"),&RigidBody2D::set_applied_force);
ObjectTypeDB::bind_method(_MD("get_applied_force"),&RigidBody2D::get_applied_force);
ObjectTypeDB::bind_method(_MD("set_applied_torque","torque"),&RigidBody2D::set_applied_torque);
ObjectTypeDB::bind_method(_MD("get_applied_torque"),&RigidBody2D::get_applied_torque);
ObjectTypeDB::bind_method(_MD("set_sleeping","sleeping"),&RigidBody2D::set_sleeping);
ObjectTypeDB::bind_method(_MD("is_sleeping"),&RigidBody2D::is_sleeping);

View File

@ -266,6 +266,9 @@ public:
void set_applied_force(const Vector2& p_force);
Vector2 get_applied_force() const;
void set_applied_torque(const float p_torque);
float get_applied_torque() const;
Array get_colliding_bodies() const; //function for script