jPCT-AE - a 3d engine for Android > Support

Object3D rotation around another object

<< < (2/4) > >>

phmenard:
ok did that ... now the earth is just sitting there spinning rather that rotating around the center ... hmm ... any advice??

EgonOlsen:
Sounds like as if you are rotating the earth now....create the center, maek earth a child of it and then rotate the center, not the earth.

phmenard:
silly me ... works perfect ... just need to rotate on the z axis not the y. What's up with these dummy objects any way??? are they costly to have around?? ... example ... a model of our solar system would require 9 dummy objects to control the orbits of each planet given that they orbit and rotate at different speeds.0 ... would it be better to use some old school math???

kinda off topic but while I'm here ... is there a way to make an abject glow .. like a sun ... texture effect maybe??

thanks a bunch for your help EgonOlsen

EgonOlsen:

--- Quote from: phmenard on September 10, 2013, 12:07:50 am --- ... would it be better to use some old school math???

--- End quote ---
No. Dummy objects are cheap.


--- Quote from: phmenard on September 10, 2013, 12:07:50 am ---kinda off topic but while I'm here ... is there a way to make an abject glow .. like a sun ... texture effect maybe??

--- End quote ---
Maybe a glow texture with an alpha mask placed on a billboarded quad in the center of the sun will look good enough?

phmenard:
ok thanks ... before I end this thread what would be the best way to go about making an elliptical orbit rather than a circle given the fact most planets don't orbit in a perfect circle ... I playing around with code like this but I'm not able to get it right.


--- Code: ---
SimpleVector sv = new SimpleVector();
sv.x = (float) (myOrbit.getTransformedCenter().x + Math.sin(myOrbitAngle*Math.PI/180) * Math.cos(myOrbitAngle*Math.PI/180));
sv.y = (float) (myOrbit.getTransformedCenter().y  + Math.sin(myOrbitAngle*Math.PI/180));// * Math.sin(.5));
//sv.z = (float) (myOrbit.getTransformedCenter().z  + Math.cos(myOrbitAngle*Math.PI/180));


myOrbitAngle += myOrbitSpeed; 

myObject.translate(sv);
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version