title: Instantaneous change in velocity using a velocity verlet integrator
body: <pre><code>    var nx = x + velX * dt + accX * (dt * dt * 0.5);
      var ny = y + velY * dt + accY * (dt * dt * 0.5);
      var na = a + velA * dt + accA * (dt * dt * 0.5);
  
      var nAccX = 0; var nAccY = 0;
      var nAccA = 0;
      var i = -1; repeat( ds_list_size(physics_forces) ) { i++;
          
          var force = physics_forces[| i]; //r3_scale( physics_forces[| i], 1 / dt, physics_forces[| i] );
          
          nAccX += clamp(force[0], -physics_maxImpulse, physics_maxImpulse); 
          nAccY += clamp(force[1], -physics_maxImpulse, physics_maxImpulse); 
          nAccA += clamp(force[2], -physics_maxImpulseAngular, physics_maxImpulseAngular);
      }
      ds_list_clear(physics_forces);
      
      nAccX = clamp(nAccX, -physics_maxForce, physics_maxForce);
      nAccY = clamp(nAccY, -physics_maxForce, physics_maxForce);
      nAccA = clamp(nAccA, -physics_maxForceAngular, physics_maxForceAngular);
  
      var nVelX = velX + (accX + nAccX) * (dt * 0.5);
      var nVelY = velY + (accY + nAccY) * (dt * 0.5);
      var nVelA = velA + (accA + nAccA) * (dt * 0.5);
      
      x = nx;
      y = ny;
      a = na;
      velX = nVelX;
      velY = nVelY;
      velA = nVelA;
      accX = nAccX;
      accY = nAccY;
      accA = nAccA;
  </code></pre>
  <p>I have a relatively simple Velocity-Verlet Integrator set up, as seen here (per <a href="https://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet</a>)</p>
  <pre><code>player_move = function(speedChannel, index = 1, magnitude = 1, direction = a) {
      if (!is_undefined(speedChannel)) {
          var _target = animcurve_channel_evaluate(speedChannel, index);
          var _dirX = lengthdir_x(magnitude, direction);
          var _dirY = lengthdir_y(magnitude, direction);
          physics_applyForce( _target * _dirX - velX, _target * _dirY - velY );
      }
  }
  physics_applyForce = function(fx, fy, _mode = FORCEMODE.IMPULSE) {
      switch _mode {
          case FORCEMODE.IMPULSE:
              ds_list_add(physics_forces, [ fx, fy, 0 ])
          break;
          case FORCEMODE.CHANGE:
              velX = fx;
              velY = fy;
          break;
      }
  }
  </code></pre>
  <p>I want to make my player's velocity follow the shape of a curve hence the acceleration applied is the difference between target speed scaled by movement direction and the velocity.
  The issue with this is that, since the Integrator scales values by dt the <em>actual</em> acceleration is far lower than it needs to be.
  I'm sure this is a simple fix but I really cannot quite figure out the math here.</p>