Skip to content
Snippets Groups Projects
Commit 41ace53b authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Time fix

parent 9cfc8047
No related merge requests found
...@@ -54,7 +54,7 @@ public class BulletAnimated { ...@@ -54,7 +54,7 @@ public class BulletAnimated {
double cannonAngle = cannon.getAngle(); double cannonAngle = cannon.getAngle();
speed = speed speed = speed
.add(new Point2D(Math.cos(cannonAngle) * strenghtOfCannon, Math.sin(cannonAngle) * strenghtOfCannon) .add(new Point2D(Math.cos(cannonAngle) * strenghtOfCannon, Math.sin(cannonAngle) * strenghtOfCannon)
.multiply(1 / mass)); .multiply(1 / mass).multiply(timeStep/15));
} else if (!hitToGround) { } else if (!hitToGround) {
accelerate = false; accelerate = false;
Point2D airResistanceforce = new Point2D( Point2D airResistanceforce = new Point2D(
......
...@@ -24,7 +24,7 @@ public class Cannon { ...@@ -24,7 +24,7 @@ public class Cannon {
} }
public void simulate(double timeStep) { public void simulate(double timeStep) {
angle = angle + direction*0.8; angle = angle + direction*80*timeStep;
if(angle <=-90 || angle >= 0) { if(angle <=-90 || angle >= 0) {
direction*=-1; direction*=-1;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment