#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# Movement "lagging" VS smoothness

edited May 2016

I am mnodeling an aircraft. For now I would like to put aside the physics part of the program. However, I have the following issue - it is as if the object is not moving smoothly but rather in steps that I can notice. May be it is just me, but maybe there are other things I do not consider.

``````PVector velocity, acceleration, location;
PVector friction; //the force of friction
PVector fricAcc; // the acc due to friction

float k = 0.03; // the coeff of friction
float angle = 2; //the step with which the angle is changed

float mass = 1; //the mass
float maxEngineForce = 0.1; //the masimum frust force

void setup() {
frameRate (70); //have no idea whether this part works at all

location     = new PVector (100,100);
velocity     = new PVector (0,0);
acceleration = new PVector (0,maxEngineForce/mass);

friction = new PVector (0,0);
fricAcc = new PVector (0,0);

size (1000,1000);

}

void draw () {
background (40);

fill (50);
ellipse (location.x, location.y, 50,50);

//calculating movement

//calculating the force of friction F = -kv
friction.set (-velocity.x, -velocity.y);
friction.mult (k);

//calculating the acc due to friction a = F/m
fricAcc.set (friction.x, friction.y);
fricAcc.mult (1/mass);

//showing the vector of acceleration
pushMatrix ();
translate (location.x, location.y);
PVector show = new PVector (acceleration.x, acceleration.y);
show.mult (1000);

line (0,0, show.x, show.y);
popMatrix();

}

//changing the direction of the acceleration
void keyPressed () {

if (key == 'w') {
}

if (key == 'a') {
}

if (key == 'd') {
}

println (angle); //needed for debugging

}
``````
Tagged: