Author Topic: About skybox again  (Read 785 times)

Offline denzel

  • byte
  • *
  • Posts: 22
    • View Profile
About skybox again
« 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

Rotate

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: About skybox again
« Reply #1 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.

Offline denzel

  • byte
  • *
  • Posts: 22
    • View Profile
Re: About skybox again
« Reply #2 on: February 27, 2012, 04:57:58 am »
yes, i make an obj for my ground and it works now.
I mistake the skybox