formatting and minor tweaks to constraint strengths

This commit is contained in:
Andrew Meadows 2014-07-29 16:48:34 -07:00
parent 34628aef3b
commit 67b9c185eb
4 changed files with 5 additions and 8 deletions

View file

@ -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;
}

View file

@ -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:

View file

@ -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;
}

View file

@ -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;