Bilboarding when object has parent

Started by Klaudiusz, September 27, 2007, 11:28:59 AM

Previous topic - Next topic

Klaudiusz

Hello,

Billboarding doesn't work when object has a parent. In documentation is written that object is always faced to the camera.

EgonOlsen



EgonOlsen

Version 1.15 may fix this. Please give it a try.

Klaudiusz

Thx, i'll do this tommorow.

BTW. Maybe could You implement parent functionality also for lights and cameras? It could be usefull.

Klaudiusz

Something wrong. It goes crazy when parent object is moving (translated).

See attached example:


import java.awt.Color;

import com.threed.jpct.*;

public class TestBB {

public static void main(String[] args) {
World w = new World();
FrameBuffer fb = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_GL_AA_2X);
fb.disableRenderer(IRenderer.RENDERER_SOFTWARE);
fb.enableRenderer(IRenderer.RENDERER_OPENGL);
Object3D Toy= Primitives.getCube(10);


TextureManager tm = TextureManager.getInstance();
Texture vt = new Texture("blue067.jpg");

tm.addTexture("uv", vt);


TextureInfo ti=new TextureInfo(tm.getTextureID("uv"));
Toy.calcTextureWrapSpherical();
Toy.setTexture(ti);

Object3D Toy2=Toy.cloneObject();
Toy2.translate(35, 0, 0);
Toy.addChild(Toy2);
Toy2.setBillboarding(Object3D.BILLBOARDING_ENABLED);

w.getCamera().moveCamera(Camera.CAMERA_MOVEOUT, 200);
w.getCamera().moveCamera(Camera.CAMERA_MOVEUP, 50);
w.setAmbientLight(250, 250, 250);
Toy.build();
w.addObject(Toy);
Toy2.build();
w.addObject(Toy2);


while(!org.lwjgl.opengl.Display.isCloseRequested()) {

fb.clear(Color.PINK);
w.renderScene(fb);
w.draw(fb);
fb.update();
fb.displayGLOnly();

Toy.rotateY(-0.02f);
Toy.translate(0.01f,0,0);



try {
Thread.sleep(10);
} catch(Exception e) {}

}
fb.dispose();

}

}

EgonOlsen

I expected something to be wrong...it was just too easy... ;)
Thanks for the test case, i'll look into it.

EgonOlsen

I've updated the release version. Please have a look at the issue again to see, if this fixes your problem.

Klaudiusz

#8
Works fine. Now i can do some partices magic:) Thanks!