mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 14:29:50 +02:00
add damping to ObjectMotionState
This commit is contained in:
parent
0d3e78fdb8
commit
30200ef7eb
2 changed files with 14 additions and 0 deletions
|
@ -48,6 +48,8 @@ ObjectMotionState::ObjectMotionState() :
|
|||
_volume(DEFAULT_VOLUME),
|
||||
_friction(DEFAULT_FRICTION),
|
||||
_restitution(DEFAULT_RESTITUTION),
|
||||
_linearDamping(0.0f),
|
||||
_angularDamping(0.0f),
|
||||
_wasInWorld(false),
|
||||
_motionType(MOTION_TYPE_STATIC),
|
||||
_body(NULL),
|
||||
|
@ -79,6 +81,14 @@ void ObjectMotionState::setRestitution(float restitution) {
|
|||
_restitution = btMax(btMin(fabsf(restitution), 1.0f), 0.0f);
|
||||
}
|
||||
|
||||
void ObjectMotionState::setLinearDamping(float damping) {
|
||||
_linearDamping = btMax(btMin(fabsf(damping), 1.0f), 0.0f);
|
||||
}
|
||||
|
||||
void ObjectMotionState::setAngularDamping(float damping) {
|
||||
_angularDamping = btMax(btMin(fabsf(damping), 1.0f), 0.0f);
|
||||
}
|
||||
|
||||
void ObjectMotionState::setVolume(float volume) {
|
||||
_volume = btMax(btMin(fabsf(volume), MAX_VOLUME), MIN_VOLUME);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ public:
|
|||
void setDensity(float density);
|
||||
void setFriction(float friction);
|
||||
void setRestitution(float restitution);
|
||||
void setLinearDamping(float damping);
|
||||
void setAngularDamping(float damping);
|
||||
void setVolume(float volume);
|
||||
|
||||
float getMass() const { return _volume * _density; }
|
||||
|
@ -93,6 +95,8 @@ protected:
|
|||
float _volume;
|
||||
float _friction;
|
||||
float _restitution;
|
||||
float _linearDamping;
|
||||
float _angularDamping;
|
||||
bool _wasInWorld;
|
||||
MotionType _motionType;
|
||||
|
||||
|
|
Loading…
Reference in a new issue