Any other rotation pivot then (0,0,0) for a bill boarded object makes not much sense IMHO, because albeit supported, the outcome is unpredictable (maybe not for people which are better in thinking in 3d than i am, but for me, it is...). Translation doesn't really work either, because (like mentioned in the other thread), the translation is rotated too, which is correct but doesn't create the result one wants in this special case. I suggest to shift the object in object space to get the desired result. You don't need to create additional polygons...just translate the existing ones and make that translation permanent to the mesh. That's pretty easy. If you would be using the getPlane()-method from Primitives, the returned planes already are build in a way that the parent of the bill boarded object in at the desired position. If it's not, apply an offset to the mesh like so:
import java.awt.Color;
import com.threed.jpct.*;
public class TestBB2 {
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 toy= Primitives.getCube(5);
Object3D toy2=Primitives.getPlane(2, 10f);
toy2.setBillboarding(Object3D.BILLBOARDING_ENABLED);
toy.setScale(0.5f);
toy2.setScale(2f);
toy.setAdditionalColor(Color.BLUE);
toy2.setAdditionalColor(Color.YELLOW);
w.getCamera().moveCamera(Camera.CAMERA_MOVEOUT, 100);
w.getCamera().moveCamera(Camera.CAMERA_MOVEUP, 50);
w.setAmbientLight(130, 130, 130);
toy.build();
toy2.build();
toy.setRotationPivot(new SimpleVector(-50,0,0));
toy2.addParent(toy);
w.addObject(toy);
w.addObject(toy2);
w.getCamera().lookAt(toy.getTransformedCenter());
offset(toy2, new SimpleVector(10,10,0));
while(!org.lwjgl.opengl.Display.isCloseRequested()) {
fb.clear(Color.RED);
w.renderScene(fb);
w.draw(fb);
fb.update();
fb.displayGLOnly();
toy.rotateZ(-0.02f);
toy.translate(0.01f,0,0);
try {
Thread.sleep(10);
} 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);
}
}
In this test case, i'm offsetting the plane in a way that creates the result that you already have. If you leave out the offset-call, you'll get what you want. Transfered to your case, just use that little offset-method on your bill boards with the proper value and i hope it works out well enough...