Skip to content

Commit

Permalink
mod: fix the formulas in BG_EvaluateTrajectoryDelta() - patch by
Browse files Browse the repository at this point in the history
zittrig-4/dev/humancontroller
  • Loading branch information
IR4T4 committed Jan 10, 2019
1 parent d78d562 commit c9046e1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/game/bg_misc.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3025,7 +3025,7 @@ void BG_EvaluateTrajectory(const trajectory_t *tr, int atTime, vec3_t result, qb
break; break;
case TR_SINE: case TR_SINE:
deltaTime = (atTime - tr->trTime) / (float) tr->trDuration; deltaTime = (atTime - tr->trTime) / (float) tr->trDuration;
phase = sin(deltaTime * M_PI * 2); phase = sin(deltaTime * M_TAU_F);
VectorMA(tr->trBase, phase, tr->trDelta, result); VectorMA(tr->trBase, phase, tr->trDelta, result);
break; break;
case TR_LINEAR_STOP: case TR_LINEAR_STOP:
Expand Down Expand Up @@ -3320,12 +3320,12 @@ void BG_EvaluateTrajectoryDelta(const trajectory_t *tr, int atTime, vec3_t resul
break; break;
case TR_SINE: case TR_SINE:
deltaTime = (atTime - tr->trTime) / (float) tr->trDuration; deltaTime = (atTime - tr->trTime) / (float) tr->trDuration;
phase = cos(deltaTime * M_PI * 2); // derivative of sin = cos phase = cos(deltaTime * M_PI * 2); // derivative of sin = cos
phase *= 0.5; phase *= M_PI * 2 * 1000 / (float)tr->trDuration;
VectorScale(tr->trDelta, phase, result); VectorScale(tr->trDelta, phase, result);
break; break;
case TR_LINEAR_STOP: case TR_LINEAR_STOP:
if (atTime > tr->trTime + tr->trDuration) if (atTime > tr->trTime + tr->trDuration || atTime < tr->trTime)
{ {
VectorClear(result); VectorClear(result);
return; return;
Expand Down

0 comments on commit c9046e1

Please sign in to comment.