Thanks Egon and Thanks to paul for his examples. Dummy object did the trick
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jcptexp;
import com.threed.jpct.*;
import java.awt.Color;
public class JcptExp {
public static void main(String[] args) {
World w = new World();
FrameBuffer fb = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
fb.disableRenderer(IRenderer.RENDERER_SOFTWARE);
fb.enableRenderer(IRenderer.RENDERER_OPENGL);
Object3D dummy=Object3D.createDummyObj();
Object3D toy= Primitives.getCube(1);
Object3D toy2=Primitives.getPlane(2, 10f);
toy.setScale(0.5f);
toy2.setScale(2f);
toy.setAdditionalColor(Color.BLUE);
toy2.setAdditionalColor(Color.YELLOW);
toy2.setEnvmapDirection(Object3D.ENVMAP_XZ);
toy2.rotateAxis(toy2.getRotationMatrix().getXAxis(), -0.3f);
toy2.rotateAxis(toy2.getRotationMatrix().getYAxis(),0.2f);
toy2.rotateAxis(toy2.getRotationMatrix().getYAxis(), -0.2f);
w.getCamera().moveCamera(Camera.CAMERA_MOVEOUT, 100);
w.getCamera().moveCamera(Camera.CAMERA_MOVEUP, 50);
w.getCamera().setOrientation(SimpleVector.create(1,0,0), SimpleVector.create(0,-1,0));
w.getCamera().align(toy2);
w.setAmbientLight(130, 130, 130);
toy2.setOrientation(SimpleVector.create(1,0,0), SimpleVector.create(0,-1,0));
dummy.setOrientation(SimpleVector.create(1,0,0), SimpleVector.create(0,-1,0));
toy2.rotateZ(0.01f);
toy.build();
toy2.build();
float[] bounds=toy2.getMesh().getBoundingBox();
toy.addParent(toy2);
toy2.addParent(dummy);
w.addObject(toy);
w.addObject(toy2);
w.getCamera().lookAt(toy.getTransformedCenter());
offset(toy2, new SimpleVector(2,2,0));
int i=-1;
while(!org.lwjgl.opengl.Display.isCloseRequested()) {
i*=-1;
//dummy.setRotationPivot(SimpleVector.create(i*0.001f,0,0));
dummy.rotateAxis(dummy.getRotationMatrix().getYAxis(),-0.0002f);
fb.clear(Color.RED);
w.renderScene(fb);
w.draw(fb);
fb.update();
fb.displayGLOnly();
try {
//Thread.sleep(100);
} catch(Exception e) {}
}
fb.dispose();
System.exit(0);
}
static private void offset(Object3D which, SimpleVector amount) {
Matrix mb=which.getTranslationMatrix();
which.setTranslationMatrix(new Matrix());
which.translate(amount);
which.translateMesh();
which.setTranslationMatrix(mb);
}
}