mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-17 18:46:31 +02:00
formatting and minor tweaks to constraint strengths
This commit is contained in:
parent
34628aef3b
commit
67b9c185eb
4 changed files with 5 additions and 8 deletions
|
@ -16,8 +16,7 @@
|
|||
|
||||
const float DEFAULT_MUSCLE_STRENGTH = 0.5f * MAX_MUSCLE_STRENGTH;
|
||||
|
||||
MuscleConstraint::MuscleConstraint(VerletPoint* parent, VerletPoint* child)
|
||||
: _rootPoint(parent), _childPoint(child),
|
||||
MuscleConstraint::MuscleConstraint(VerletPoint* parent, VerletPoint* child) : _rootPoint(parent), _childPoint(child),
|
||||
_parentIndex(-1), _childndex(-1), _strength(DEFAULT_MUSCLE_STRENGTH) {
|
||||
_childOffset = child->_position - parent->_position;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
// MuscleConstraint is a simple constraint that pushes the child toward an offset relative to the parent.
|
||||
// It does NOT push the parent.
|
||||
|
||||
const float MAX_MUSCLE_STRENGTH = 0.5f;
|
||||
const float MAX_MUSCLE_STRENGTH = 0.75f;
|
||||
|
||||
class MuscleConstraint : public Constraint {
|
||||
public:
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
|
||||
#include "VerletPoint.h"
|
||||
|
||||
const float INTEGRATION_FRICTION_FACTOR = 0.6f;
|
||||
|
||||
void VerletPoint::integrateForward() {
|
||||
glm::vec3 oldPosition = _position;
|
||||
_position += 0.6f * (_position - _lastPosition);
|
||||
_position += INTEGRATION_FRICTION_FACTOR * (_position - _lastPosition);
|
||||
_lastPosition = oldPosition;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,6 @@ public:
|
|||
void accumulateDelta(const glm::vec3& delta);
|
||||
void applyAccumulatedDelta();
|
||||
|
||||
glm::vec3 getAccumulatedDelta() const {
|
||||
return (_numDeltas > 0) ? _accumulatedDelta / (float)_numDeltas : glm::vec3(0.0f);
|
||||
}
|
||||
|
||||
glm::vec3 _position;
|
||||
glm::vec3 _lastPosition;
|
||||
float _mass;
|
||||
|
|
Loading…
Reference in a new issue