I want to move a object (satelite) in a ellipse around another object (earth), I tried it this way
Vector3f[] modelSatelitePoints = new Vector3f[]{
new Vector3f(300, 50, 350),
new Vector3f(950, 0, 0),
new Vector3f(300, -50, -750),
new Vector3f(-350, 0, 0),
new Vector3f(300, 50, 350)
};
BezierCurve curveSatelite = new BezierCurve("modelSatelite path", modelSatelitePoints);
CurveController ccSatelite = new CurveController(curveSatelite, modelSatelite);
it works nearly fine, but the problem is it no closed cicle/ellipse, so when the satelite reaches the endpoint its turning looks strange.
One posibility would be to rotate the satelite around the earth, that way i would get a closed circle, but is there a way i could get it move on a ellipse?
Node nodeModelSatelite = new Node("nodeModelSatelite");
nodeModelSatelite.setLocalTranslation(modelEarth.getLocalTranslation());
nodeModelSatelite.attachChild(modelSatelite);
SpatialTransformer stSatelite = new SpatialTransformer(1);
stSatelite.setObject(nodeModelSatelite, 0, -1);
// Assign a rotation for object 0 at time 0 to rotate 0 degrees around
Quaternion stSateliteX0 = new Quaternion();
stSateliteX0.fromAngleAxis(0, new Vector3f(0, 1.0f, 0.4f));
stSatelite.setRotation(0, 0, stSateliteX0);
// Assign a rotation for object 0 at time 2 to rotate 180 degrees
Quaternion stSateliteX180 = new Quaternion();
stSateliteX180.fromAngleAxis(FastMath.DEG_TO_RAD * 180, new Vector3f(0, 1.0f, 0.4f));
stSatelite.setRotation(0, 2, stSateliteX180);
// Assign a rotation for object 0 at time 4 to rotate 360 degrees
Quaternion stSateliteX360 = new Quaternion();
stSateliteX360.fromAngleAxis(FastMath.DEG_TO_RAD * 360, new Vector3f(0, 1.0f, 0.4f));
stSatelite.setRotation(0, 4, stSateliteX360);