Hey all,
I am a JME noob trying to find an easy solution to using the ChaseCamera to orbit around my main model.
Is there an easy way to avoid that the camera also "orbits/moves" the light source in the process ?
My current thoughts:
Either move the light source in the opposite direction of the camera movement, - or
Use more than one camera ?
Any help appreciated !
Cheers
travisdk
I don't think the lights should be moving with your camera. How is your scene setup? Are you using any light nodes?
Hi Rimon,
I dont use Lightnode but a pointlight attached to lightstate and it seems to move the lightsource as well (the shadow is always in the same place !):
…
protected void simpleInitGame() {
pl = new PointLight();
pl.setAmbient(new ColorRGBA(0.75f, 0.75f, 0.75f, 1));
pl.setDiffuse(new ColorRGBA(1, 1, 1, 1));
pl.setLocation(new Vector3f(10, 0, 0));
pl.setEnabled(true);
lightState.attach(pl);
ObjToJmeNew converter=new ObjToJmeNew();
try {
URL objFile= this.getClass().getClassLoader().getResource("my/pack/c-ds2.obj");
ByteArrayOutputStream BO=new ByteArrayOutputStream();
converter.setProperty("mtllib",objFile);
converter.convert(objFile.openStream(),BO);
Node r= (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
rootNode.attachChild®;
viser = r.getChild("Viser");
Node cir = (Node)r.getChild("Cir");
Node cube = (Node)r.getChild("Case");
Spatial empty = r.getChild("MyEmpty");
Texture tex = TextureManager.loadTexture(this.getClass().getClassLoader().getResource("my/pack/chrome.jpg"),
Texture.MinificationFilter.Trilinear,
Texture.MagnificationFilter.Bilinear);
tex.setEnvironmentalMapMode(Texture.EnvironmentalMapMode.ReflectionMap);
TextureState ts = display.getRenderer().createTextureState();
ts.setTexture(tex, 1);
ts.setEnabled(true);
MaterialState ms = (MaterialState)cir.getChild(0).getRenderState(RenderState.RS_MATERIAL);
for (int i = 0; i<r.getQuantity();i++) {
Node firstchild = (Node)r.getChild(i);
if (firstchild.getQuantity()>0)
if (firstchild.getChild(0).getRenderState(RenderState.RS_MATERIAL)==ms )
firstchild.getChild(0).setRenderState(ts);
}
chaser = new ChaseCamera(cam, r);
chaser.getMouseLook().setLookMouseButton(0);
MouseInput.get().setCursorVisible(true);
} catch (IOException ex) {
System.out.println("CRASH");
}