SkyBox and Camera Rotation

Started by Kaiidyn, February 17, 2011, 10:34:50 PM

Previous topic - Next topic

Kaiidyn

I added a skybox to my game, but when I rotate my camera, I'm always facing the same side of the skybox.. its like its a far away billboarded object.
is there any fix for this?

(using http://www.jpct.net/forum2/index.php/topic,1873.msg13762.html#msg13762 )
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

Thomas.

you have to also rotate camera in skybox

Kaiidyn

Ok, makes sense.. but how do i get the rotation from my own camera? As I use lookat object for my rotation...
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

EgonOlsen

Quote from: Thomas. on February 17, 2011, 11:07:54 PM
you have to also rotate camera in skybox
No, actually you don't. The skybox class does this for you. If the skybox doesn't move, you are doing something strange with the camera or feed the wrong world into the skybox's render-method. Can you post a code snippet that shows your render loop?

Kaiidyn

#4
Im using skybox.render(skybox.getWorld(), fb); to render it.. or should i use my main world instead?
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

EgonOlsen

Yes, use the main world. Using the world from the skybox makes no sense. Maybe i should make this clearer in the docs. The getWorld in SkyBox is just there to provide a hook into SkyBox in case you want to do something that the implementation itself doesn't cover.

Kaiidyn

#6
Ah ok, I'll try that when I get home.
Thanks :)

edit: It's working now :) thanks again.
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch