About skybox again

Started by denzel, February 26, 2012, 09:36:28 AM

Previous topic - Next topic

denzel

I add a skybox in my demo,and move the skybox-center.
But when i rotate the wolrd's camera,my model looks like under the skybox, why?
Am i mistake sth?
the code:
Build a skybox and move its center to make my model looks like is in the floor
SkyBox skyBox = new SkyBox("texture", "texture", "texture", "texture", "texture", "floor", 6000);
SimpleVector skyVector = new  SimpleVector(0, -2500, 0);
skyBox.setCenter(skyVector);


Rotate the camera in the world
float distance = camera.getPosition().distance(centerVector);
camera.moveCamera(Camera.CAMERA_MOVEIN, distance);
camera.rotateCameraX((float) Math.toRadians(60));
camera.moveCamera(Camera.CAMERA_MOVEOUT, distance);
camera.lookAt(centerVector);


The img:
Normal

Rotate

EgonOlsen

You are abusing the skybox here a little bit as you are using it's lower plane as the ground for your object and the skybox is a actually a room that contains the obejct. It's not meant to be used this way. I suggest to not use the skybox at all but to create it, get the skybox object from the SkyBox' world instance and add a copy of it to your own world. Then ditch the SkyBox instance. That should be easier to handle to close to what you actually want.

denzel

yes, i make an obj for my ground and it works now.
I mistake the skybox