1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00

Changes to 2D physics engine

-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-Removed "density" property
-Added instead more flexible "angular damp" and "linear damp"
-Added ability to override angular and linear damp in rigidbody
-Added gravity scale option rigidbody

Test well and iron out bugs, when it works the same will be moved to 3D
This commit is contained in:
Juan Linietsky
2015-01-05 18:37:12 -03:00
parent 1ff0d5c4e5
commit b51f645711
13 changed files with 188 additions and 42 deletions

View File

@@ -43,7 +43,8 @@ protected:
public:
virtual Vector2 get_total_gravity() const=0; // get gravity vector working on this body space/area
virtual float get_total_density() const=0; // get density of this body space/area
virtual float get_total_linear_damp() const=0; // get density of this body space/area
virtual float get_total_angular_damp() const=0; // get density of this body space/area
virtual float get_inverse_mass() const=0; // get the mass
virtual real_t get_inverse_inertia() const=0; // get density of this body space
@@ -277,7 +278,6 @@ public:
SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD,
SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD,
SPACE_PARAM_BODY_TIME_TO_SLEEP,
SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO,
SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS,
};
@@ -301,7 +301,8 @@ public:
AREA_PARAM_GRAVITY_VECTOR,
AREA_PARAM_GRAVITY_IS_POINT,
AREA_PARAM_GRAVITY_POINT_ATTENUATION,
AREA_PARAM_DENSITY,
AREA_PARAM_LINEAR_DAMP,
AREA_PARAM_ANGULAR_DAMP,
AREA_PARAM_PRIORITY
};
@@ -401,6 +402,9 @@ public:
BODY_PARAM_BOUNCE,
BODY_PARAM_FRICTION,
BODY_PARAM_MASS, ///< unused for static, always infinite
BODY_PARAM_GRAVITY_SCALE,
BODY_PARAM_LINEAR_DAMP,
BODY_PARAM_ANGULAR_DAMP,
BODY_PARAM_MAX,
};
@@ -414,7 +418,7 @@ public:
BODY_STATE_LINEAR_VELOCITY,
BODY_STATE_ANGULAR_VELOCITY,
BODY_STATE_SLEEPING,
BODY_STATE_CAN_SLEEP
BODY_STATE_CAN_SLEEP,
};
virtual void body_set_state(RID p_body, BodyState p_state, const Variant& p_variant)=0;