Author Topic: SkyBox and Camera Rotation  (Read 2233 times)

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
SkyBox and Camera Rotation
« 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 )
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

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: SkyBox and Camera Rotation
« Reply #1 on: February 17, 2011, 11:07:54 pm »
you have to also rotate camera in skybox

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Re: SkyBox and Camera Rotation
« Reply #2 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...
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11744
    • View Profile
    • http://www.jpct.net
Re: SkyBox and Camera Rotation
« Reply #3 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?

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Re: SkyBox and Camera Rotation
« Reply #4 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?
« Last Edit: February 18, 2011, 12:15:39 am by Kaiidyn »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11744
    • View Profile
    • http://www.jpct.net
Re: SkyBox and Camera Rotation
« Reply #5 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.

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Re: SkyBox and Camera Rotation
« Reply #6 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.
« Last Edit: February 18, 2011, 12:07:25 pm by Kaiidyn »
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