@Override public void update(final float theDeltaTime) { _myNoise = new CCSimplexNoise(); _myNoiseOffset += theDeltaTime * _cNoiseSpeed; _myTarget = target(_myNoiseOffset); _myLimitedPosition = _myLimiter.limit2(_myTarget, theDeltaTime); _myTargetBuffer.add(_myTarget); _myPositionBuffer.add(_myLimitedPosition); _myFuturePositionBuffer.add((float) _myLimiter.futurePosition()); _myVelocityBuffer.add((float) _myLimiter.velocity() / _myLimiter._cMaxVelocity); _myAccelerationBuffer.add((float) _myLimiter.acceleration() / _myLimiter._cMaxAcceleration); }
@Override public void draw() { g.clear(); int y = 0; g.color(255, 255, 0); drawInfo(-width / 2 + 10, height / 2 - (y -= 20), _myTarget, "target"); g.color(255); drawInfo(-width / 2 + 10, height / 2 - (y -= 20), _myLimitedPosition, "limited position"); g.color(0, 255, 255); drawInfo( -width / 2 + 10, height / 2 - (y -= 20), (float) _myLimiter.futurePosition(), "future position"); g.color(255); drawBuffer(_myPositionBuffer, 1); g.color(255, 0, 0); drawBuffer(_myVelocityBuffer, width / 3); g.color(0, 255, 0); drawBuffer(_myAccelerationBuffer, width / 3); g.color(0, 0, 255); drawBuffer(_myTargetBuffer, 1); }