- try to see if this helps with the tween bug

This commit is contained in:
Mark Vejvoda
2011-07-19 01:25:38 +00:00
parent 45db0a3290
commit ee2c7bbe98

View File

@@ -921,8 +921,13 @@ void ProjectileParticleSystem::update(){
Vec3f currentVector= flatPos - startPos; Vec3f currentVector= flatPos - startPos;
// ratio // ratio
float t= clamp(currentVector.length() / targetVector.length(), 0.0f, 1.0f); float relative= clamp(currentVector.length() / targetVector.length(), 0.0f, 1.0f);
setTween(t,currentVector.length()); #ifdef USE_STREFLOP
float absolute= clamp(streflop::fabs(currentVector.length()), 0.0f, 1.0f);
#else
float absolute= clamp(fabs(currentVector.length()), 0.0f, 1.0f);
#endif
setTween(relative,absolute);
// trajectory // trajectory
switch(trajectory) { switch(trajectory) {
@@ -932,7 +937,7 @@ void ProjectileParticleSystem::update(){
break; break;
case tParabolic: { case tParabolic: {
float scaledT= 2.0f * (t - 0.5f); float scaledT= 2.0f * (relative - 0.5f);
float paraboleY= (1.0f - scaledT * scaledT) * trajectoryScale; float paraboleY= (1.0f - scaledT * scaledT) * trajectoryScale;
pos= flatPos; pos= flatPos;
@@ -943,11 +948,11 @@ void ProjectileParticleSystem::update(){
case tSpiral: { case tSpiral: {
pos= flatPos; pos= flatPos;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
pos+= xVector * streflop::cos(t * trajectoryFrequency * targetVector.length()) * trajectoryScale; pos+= xVector * streflop::cos(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale;
pos+= yVector * streflop::sin(t * trajectoryFrequency * targetVector.length()) * trajectoryScale; pos+= yVector * streflop::sin(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale;
#else #else
pos+= xVector * cos(t * trajectoryFrequency * targetVector.length()) * trajectoryScale; pos+= xVector * cos(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale;
pos+= yVector * sin(t * trajectoryFrequency * targetVector.length()) * trajectoryScale; pos+= yVector * sin(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale;
#endif #endif
} }
break; break;