fix halfellipsemover so it doesnt get stuck
This commit is contained in:
parent
e082adb37f
commit
6965e33856
|
@ -30,8 +30,8 @@ public class HalfEllipseMover extends Mover {
|
||||||
|
|
||||||
public HalfEllipseMover(GameObject start, GameObject end, int dir) {
|
public HalfEllipseMover(GameObject start, GameObject end, int dir) {
|
||||||
super(start, end, dir);
|
super(start, end, dir);
|
||||||
middlex = (startX - endX) / 2d;
|
middlex = (startX + endX) / 2d;
|
||||||
middley = (startY - endY) / 2d;
|
middley = (startY + endY) / 2d;
|
||||||
radius = Utils.distance(middlex, middley, startX, startY);
|
radius = Utils.distance(middlex, middley, startX, startY);
|
||||||
ang = Math.atan2(startY - middley, startX - middlex);
|
ang = Math.atan2(startY - middley, startX - middlex);
|
||||||
mod = 2d;
|
mod = 2d;
|
||||||
|
@ -44,8 +44,8 @@ public class HalfEllipseMover extends Mover {
|
||||||
@Override
|
@Override
|
||||||
public double[] getPointAt(int time) {
|
public double[] getPointAt(int time) {
|
||||||
double Tangle = Math.PI * getT(time) * dir;
|
double Tangle = Math.PI * getT(time) * dir;
|
||||||
double x = middlex + Math.cos(Tangle) * radius;
|
double x = middlex + Math.cos(Tangle) * radius * mod; // TODO fix this
|
||||||
double y = middley + Math.sin(Tangle) * radius;
|
double y = middley + Math.sin(Tangle) * radius * mod;
|
||||||
double dx = middlex - x;
|
double dx = middlex - x;
|
||||||
double dy = middley - y;
|
double dy = middley - y;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user