How rotate object around pivot?
example: earth=obj , Sun=pivot.
or example "Multiple light sources".
By setting a rotation pivot using Object3D.setRotationPivot()...
earth.setRotationPivot(pivotsun);
//no rotate
onDrawFrame(GL10 gl) {
earth.rotateY(2);
}
??? And the question is...??? That's not the complete code, isn't it? What do you expect it to do, what does it do? You can be sure that a call to rotateY(...) DOES rotate the object.
With earth.setBillboarding(true); not working, without earth.setBillboarding(true); works!!!
Here the code:
earth= new Object3D(dummyPlane, true);
earth.setTexture("glow");
earth.setAdditionalColor(RGBColor.WHITE);
earth.setLighting(Object3D.LIGHTING_NO_LIGHTS);
earth.setTransparencyMode(Object3D.TRANSPARENCY_MODE_ADD);
earthsetTransparency(7);
earth.setBillboarding(true);
earth.shareCompiledData(dummyPlane);
earth.build();
earth.strip();
earth.translate(0.22f,-25, -0.12f);
world.addObject(earth);
public void onDrawFrame(GL10 gl) {
try {
SimpleVector pivotsun= new SimpleVector();
pivotsun.x = -20;
pivotsun.y = -25;
pivotsun.z = -13;
earth.setRotationPivot(pivotsun);
//earth.getTransformedCenter(pivotsun);
//earth.translate(pivotsun);
earth.rotateY(0.05f);
}
That's because bill boarding replaces the actual rotation matrix...hmmm...try to use dummy objects instead. Object3D has a static method to create a dummy object. Place dummies with the correct rotation pivot at the location where you want the bill boards to be rendered and then do something like:
bill.clearTranslation();
bill.translate(dummy.getTranslation());
Thank You EgonOlsen, Worked perfect. But,is possible attach light to Dummy?.
No, not directly. You have to set the light's position to the dummy's translation in code.