mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Improve RigidDynamicBody force and torque API
Makes the API for forces and impulses more flexible, easier to understand and harmonized between 2D and 3D. Rigid bodies now have 3 sets of methods for forces and impulses: -apply_impulse() for impulses (one-shot and time independent) -apply_force() for forces (time dependent) applied for the current step -add_constant_force() for forces that keeps being applied each step Also updated the documentation to clarify the different methods and parameters in rigid body nodes, body direct state and physics servers.
This commit is contained in:
@@ -213,18 +213,24 @@ public:
|
||||
FUNC3(body_set_state, RID, BodyState, const Variant &);
|
||||
FUNC2RC(Variant, body_get_state, RID, BodyState);
|
||||
|
||||
FUNC2(body_set_applied_force, RID, const Vector2 &);
|
||||
FUNC1RC(Vector2, body_get_applied_force, RID);
|
||||
|
||||
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_apply_central_force, RID, const Vector2 &);
|
||||
FUNC3(body_apply_force, RID, const Vector2 &, const Vector2 &);
|
||||
FUNC2(body_apply_torque, RID, real_t);
|
||||
|
||||
FUNC2(body_add_constant_central_force, RID, const Vector2 &);
|
||||
FUNC3(body_add_constant_force, RID, const Vector2 &, const Vector2 &);
|
||||
FUNC2(body_add_constant_torque, RID, real_t);
|
||||
|
||||
FUNC2(body_set_constant_force, RID, const Vector2 &);
|
||||
FUNC1RC(Vector2, body_get_constant_force, RID);
|
||||
|
||||
FUNC2(body_set_constant_torque, RID, real_t);
|
||||
FUNC1RC(real_t, body_get_constant_torque, RID);
|
||||
|
||||
FUNC2(body_set_axis_velocity, RID, const Vector2 &);
|
||||
|
||||
FUNC2(body_add_collision_exception, RID, RID);
|
||||
|
||||
Reference in New Issue
Block a user