Skybox disappear when camera attached to another SceneNode??

guk_guk41

19-12-2008 23:34:38

I tried to attach default camera created by ofusion to another sceneNode since I want to create a collision detection system using OgreNewt. When I tried to attach mCamera directly to a cameraNode like this


camNode = mSceneMgr->getSceneNode("d_cameraPos");

if (mCam){
// attach camera to camNode
camNode->attachObject(mCamera);
};


My App basically just thown this exception



So I just change my code to be similar like this


if (mCam){

initialCamNode = mCamera->getParentSceneNode();

// detach camera from its initial scene node
initialCamNode->detachAllObjects();
};

camNode = mSceneMgr->getSceneNode("d_cameraPos");

if (mCam){
// attach camera to camNode
camNode->attachObject(mCamera);
};


Then another oddity comes in, my default skybox just disappear.



This is my app looks when camera isn't attached to camNode


Please, can somebody explain to me how to properly detach and attach mCamera from default SceneNode to my own Camera Node since I want to create a collision detection system.

Lioric

23-12-2008 01:46:20

Nice scene ;)

(You might want to add some FSAA for better resolution)

Are you using any manual rendering?

The sky is updated to the current camera position automatically by Ogre, the sky is added to the proper render queue as needed, this might not apply if you are manully changing the render process

See if manually adding "SceneManager::_queueSkiesForRendering(yourSceneCam)" before you render each frame changes it

Or review if sky display is enabled in your viewport by using "Viewport::setSkiesEnabled(true)" method

Or set a breakpoint in the SceneManager "_queueSkiesForRendering" and "_renderScene" methods to review if they are correctly rendering the sky (updating with the correct camera) and to identify why it is not displayed in your scene

guk_guk41

04-01-2009 12:32:57

well, FYI, I don't use manual rendering. I modified Example Framework that "shipped with" OgreSDK.

I tried Viewport::setSkiesEnabled(true) but I doesn't work. Do you have another suggestion ??

Lioric

04-01-2009 19:29:43

Yes, the other suggestions in the previous post

Remove your scene objects and materials (just the sky), see if your sky is displayed and start adding them progressively to determine where (and why) the sky is not being displayed