www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Kaiidyn on February 17, 2011, 10:34:50 pm

Title: SkyBox and Camera Rotation
Post by: Kaiidyn on February 17, 2011, 10:34:50 pm
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 )
Title: Re: SkyBox and Camera Rotation
Post by: Thomas. on February 17, 2011, 11:07:54 pm
you have to also rotate camera in skybox
Title: Re: SkyBox and Camera Rotation
Post by: Kaiidyn on February 17, 2011, 11:27:45 pm
Ok, makes sense.. but how do i get the rotation from my own camera? As I use lookat object for my rotation...
Title: Re: SkyBox and Camera Rotation
Post by: EgonOlsen on February 17, 2011, 11:56:13 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?
Title: Re: SkyBox and Camera Rotation
Post by: Kaiidyn on February 18, 2011, 12:13:58 am
Im using skybox.render(skybox.getWorld(), fb); to render it.. or should i use my main world instead?
Title: Re: SkyBox and Camera Rotation
Post by: EgonOlsen on February 18, 2011, 11:05:19 am
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.
Title: Re: SkyBox and Camera Rotation
Post by: Kaiidyn on February 18, 2011, 11:07:03 am
Ah ok, I'll try that when I get home.
Thanks :)

edit: It's working now :) thanks again.