Skip to content

Instantly share code, notes, and snippets.

@thomasvanta
Created May 14, 2013 21:52
Show Gist options
  • Save thomasvanta/5579913 to your computer and use it in GitHub Desktop.
Save thomasvanta/5579913 to your computer and use it in GitHub Desktop.
Processing: drag force
PVector drag = p.vel.get(); //get a copy of velocity
drag.normalize(); //normalize it
float c = -0.005; //coeficient
float speed = p.vel.mag(); //modulo de la velocidad
drag.mult(c*speed*speed);
p.applyForce(drag);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment