27 initialTime = iniTime;
29 targetPosition = finPos;
30 noiseAmplitude = defaultNoiseAmplitude;
31 noiseWaveLenght = defaultNoiseWaveLenght;
32 overshoot = defaultOvershoot;
33 offset = defaultOffset;
34 peakTime = defaultPeakTime;
35 hasOvershoot = (defaultOvershoot > 0.001);
36 hasNoise = (defaultNoiseAmplitude > 0.001);
41 noiseAmplitude = newNoiseAmplitude;
42 noiseWaveLenght = newNoiseWaveLenght;
43 previousSubGoalTime = initialTime;
44 previousSubGoalPosition = 0.0f;
45 nextSubGoalTime = initialTime + noiseWaveLenght;
46 nextSubGoalPosition = Random();
67 overshoot = amplitude;
69 hasOvershoot = (amplitude > 0.001);
80 if ((goalTime > initialTime) && (goalTime < finalTime))
82 float interpolationIndex;
88 interpolationIndex = (goalTime - activationTime) / timeRange;
92 if (interpolationIndex < peakTime)
94 goalPosition = interpolatorPtr->GetValue(interpolationIndex / peakTime,
95 initialPosition, overshootRange);
98 goalPosition = interpolatorPtr->GetValue((interpolationIndex-peakTime)/(1-peakTime),
99 overshootPosition, finalRange);
103 goalPosition = interpolatorPtr->GetValue(interpolationIndex,
104 initialPosition, positionRange);
107 float myNoise = Noise();
109 goalPosition += myNoise;
112 targetDofPtr->MoveTo(goalPosition, priority);
116 initialPosition = targetDofPtr->GetCurrent();
117 nextSubGoalPosition = Random();
119 positionRange = targetPosition + offset - initialPosition;
120 timeRange = finalTime - goalTime;
122 if (timeRange < minimumDuration)
125 timeRange = minimumDuration;
126 activationTime = goalTime;
127 overshootRange = positionRange * overshoot;
128 finalRange = -overshootRange;
129 overshootPosition = targetPosition + offset + overshootRange;
130 overshootRange += positionRange;
132 targetDofPtr->MoveTo(initialPosition, priority);
145 float subPositionRange;
148 if (goalTime > nextSubGoalTime)
150 previousSubGoalTime = nextSubGoalTime;
151 previousSubGoalPosition = nextSubGoalPosition;
152 nextSubGoalTime += noiseWaveLenght;
153 if (nextSubGoalTime > finalTime)
156 nextSubGoalTime = finalTime;
157 if ((nextSubGoalTime - previousSubGoalTime) > 0.001)
159 nextSubGoalPosition = 0.0f;
164 nextSubGoalPosition = Random();
170 if (goalTime < previousSubGoalTime)
173 previousSubGoalTime = 0.0f;
174 previousSubGoalPosition = 0.0f;
175 nextSubGoalTime = noiseWaveLenght;
176 nextSubGoalPosition = Random();
183 subPositionRange = nextSubGoalPosition - previousSubGoalPosition;
184 linearIndex = (goalTime - previousSubGoalTime)/(nextSubGoalTime-previousSubGoalTime);
185 return interpolator.
GetValue(linearIndex, previousSubGoalPosition, subPositionRange);
190 return ((static_cast<float>(rand())/RAND_MAX) - 0.5f) * noiseAmplitude;
195 defaultNoiseAmplitude = value;
200 defaultNoiseWaveLenght = value;
205 defaultOvershoot = value;
210 defaultOffset = value;
215 defaultPeakTime = value;
Header file for V-ART class "Dof".
static float defaultNoiseWaveLenght
virtual void Move()
Changes target DOF.
Smooth (sine function) interpolator.
static void SetDefaultNoiseAmplitude(float value)
NoisyDofMover()
Creates an unitialized noisy DOF mover.
Header file for V-ART class "SineInterpolator".
static void SetDefaultOvershoot(float value)
static float defaultPeakTime
void SetNoise(float newNoiseAmplitude, float newNoiseWaveLenght)
Sets the noise attributes.
float Noise()
Generates and returns corehent noise.
static void SetDefaultOffset(float value)
void SetOvershoot(float amplitude, float peak)
Sets the overshoot attributes.
virtual void Initialize(float iniTime, float finTime, float finPos)
Initializes a noisy DOF mover.
static float defaultOvershoot
float Random()
Generates and returns a pseudo-random number within internal noise amplitude.
void SetOffset(float newOffset)
Set the offset attribute.
Header file for V-ART class "NoisyDofMover".
static void SetDefaultNoiseWaveLenght(float value)
static void SetDefaultPeakTime(float value)
static float defaultOffset
static float defaultNoiseAmplitude
virtual float GetValue(float linearIndex, float initialPos, float range) const
Evaluates a goal position for DOF interpolation.