Hey,
I am having a problem with my SkyBox, it doesnt seem to stay in the view of the camera, it just seems to be a skybox in the middle of my terrain, i followed the tutorial given on SkyBox's and have
skybox.setLocalTranslation(cam.getLocation());
in my update, is there a better a way of creating a decent looking SkyBox?
Thanks
What is wrong with this??
private void buildSkyBox() {
skybox = new Skybox("skybox", 10, 10, 10);
Texture north = TextureManager.loadTexture(
Lesson4.class.getClassLoader().getResource(
"jmetest/data/texture/north.jpg"),
Texture.MM_LINEAR,
Texture.FM_LINEAR);
Texture south = TextureManager.loadTexture(
Lesson4.class.getClassLoader().getResource(
"jmetest/data/texture/south.jpg"),
Texture.MM_LINEAR,
Texture.FM_LINEAR);
Texture east = TextureManager.loadTexture(
Lesson4.class.getClassLoader().getResource(
"jmetest/data/texture/east.jpg"),
Texture.MM_LINEAR,
Texture.FM_LINEAR);
Texture west = TextureManager.loadTexture(
Lesson4.class.getClassLoader().getResource(
"jmetest/data/texture/west.jpg"),
Texture.MM_LINEAR,
Texture.FM_LINEAR);
Texture up = TextureManager.loadTexture(
Lesson4.class.getClassLoader().getResource(
"jmetest/data/texture/top.jpg"),
Texture.MM_LINEAR,
Texture.FM_LINEAR);
Texture down = TextureManager.loadTexture(
Lesson4.class.getClassLoader().getResource(
"jmetest/data/texture/bottom.jpg"),
Texture.MM_LINEAR,
Texture.FM_LINEAR);
skybox.setTexture(Skybox.NORTH, north);
skybox.setTexture(Skybox.WEST, west);
skybox.setTexture(Skybox.SOUTH, south);
skybox.setTexture(Skybox.EAST, east);
skybox.setTexture(Skybox.UP, up);
skybox.setTexture(Skybox.DOWN, down);
skybox.preloadTextures();
scene.attachChild(skybox);
}
try printing out skybox.getWorldTranslation after "skybox.setLocalTranslation(cam.getLocation());" and see if it gives you reasonable values. The only thing I can think of is that the cam you are referencing or the skybox you are referencing are not the objects you think they are.
no luck at all, when u say add skybox.getWorldTranslation after skybox.setLocalTranslation(cam.getLocation());, do u mean like an extension and also does it take in any parameters?
Ok,
its kind of working, just when i move my camera around, i can just see the skybox at the corner of the window then it disappears, ant ides how to fix this?
Silly suggestion - How about making the SkyBox larger? Like 100,100,100 vs 10,10,10?
nearest i can get to something is with 1100 ,280, 1100, but still big gaps in it
Could it be something with the camera far frustrum ( setFrustrumFar() ) setting? Maybe a screenshot would help for this, cause when you say "gaps" it's hard to guess at what you mean. It might be that the camera settings are just "clipping" the farthest edges of the SkyBox causing it to look like "holes" or "gaps".
Maybe try something like cam.setFrustrumFar(2000); and see what happens. BTW 2000 is just arbitrary, so play with it.