www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: denzel on February 26, 2012, 09:36:28 am

Title: About skybox again
Post by: denzel on February 26, 2012, 09:36:28 am
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
Code: [Select]
SkyBox skyBox = new SkyBox("texture", "texture", "texture", "texture", "texture", "floor", 6000);
Code: [Select]
SimpleVector skyVector = new  SimpleVector(0, -2500, 0);
skyBox.setCenter(skyVector);

Rotate the camera in the world
Code: [Select]
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
(http://www.tu265.com/di-cnNv31.png)
Rotate
(http://www.tu265.com/di-N5hIr1.png)
Title: Re: About skybox again
Post by: EgonOlsen on February 26, 2012, 02:40:55 pm
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.
Title: Re: About skybox again
Post by: denzel on February 27, 2012, 04:57:58 am
yes, i make an obj for my ground and it works now.
I mistake the skybox