File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
core/src/com/group/golf/Physics Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -120,10 +120,14 @@ protected boolean checkLowVelocity() {
120120 float [] slope = this .calculateSlope (new float []{this .movingBall .getX (), this .movingBall .getY ()});
121121 float vx = this .movingBall .getVelocityX ();
122122 float vy = this .movingBall .getVelocityY ();
123- if ((vx < 0 && slope [0 ] > 0 && vx >= -errorBound ) || (vx > 0 && slope [0 ] < 0 && vx <= errorBound )) {
123+ if (vx != 0 && ((vx < 0 && slope [0 ] >= 0 && vx >= -errorBound ) ||
124+ (vx > 0 && slope [0 ] <= 0 && vx <= errorBound ))) {
125+ // System.out.println("VelocityX reset!");
124126 this .movingBall .resetX ();
125127 }
126- if ((vy < 0 && slope [1 ] > 0 && vy >= -errorBound ) || (vy > 0 && slope [1 ] < 0 && vy <= errorBound )) {
128+ if (vy != 0 && ((vy < 0 && slope [1 ] >= 0 && vy >= -errorBound ) ||
129+ (vy > 0 && slope [1 ] <= 0 && vy <= errorBound ))) {
130+ // System.out.println("VelocityY reset!");
127131 this .movingBall .resetY ();
128132 }
129133 return !this .movingBall .isMoving ();
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public class RK4 extends Physics {
1818 */
1919 public RK4 (Course course ) {
2020 super (course );
21- errorBound = 0.15f ;
21+ errorBound = 0.2f ;
2222 }
2323
2424 //method to be overwritten by each subclass
You can’t perform that action at this time.
0 commit comments