Ellipse curve


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?


You could use a setup like this:


Where © is a Node located at the center of your planet, and s is the satellite which is a child of ©.

that way, you can use two SpatialTransformer Controllers, one rotating ©, and one moving s forth and back along one axis - this should give you a rather elliptic ecliptic :wink: !

i'm going to try it out. Sounds good.

Try the CatmullRomCurve class, it's designed so that the object will pass through all control points. You can find it somewhere on "User Code" forum.

today i have some kind of brainlag

i got the rotation of s around c

Node nodeModelSatelite = new Node("nodeModelSatelite");
         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);


but i don't get the second SpatialTransformer  for it.

as momoko said. use the CatmullRomCurve in combination with a CurveController