Strange Camera Issue

kungfoomasta

24-02-2007 20:00:21

I Got PLSM2 working in my eihort app, which was really great!

But I'm having a hard time figuring out what is wrong with my camera. It seems the camera cannot yaw or pitch, only translate! I've tried debugging, but I'm using a mix of native and managed C++, so the debugging capabilities don't work that well (can't step in or view a lot of informaton on variables, etc.)

I just grabbed the CVS last night, maybe I should update? Can anybody post a small portion of code involved the creation of the PLSM2 scene manager, the creation of the camera, the viewport setup, and the loading of terrain into the scene, as well as the order?

Here is what I have...

// PLSM
mSceneManager = mRoot->createSceneManager("PagingLandScapeSceneManager","SceneCreatorSceneManager");
// TSM
//mSceneManager = mRoot->createSceneManager(Ogre::ST_EXTERIOR_CLOSE,"SceneCreatorSceneManager");

// Setup camera to be used in application
mCamera = new Stormsong::Camera("SceneCreatorCamera",mSceneManager);
mViewport = mRenderWindow->addViewport(mCamera->getCamera());
mViewport->setBackgroundColour(Ogre::ColourValue(0,0,0,1.0));
mCamera->getCamera()->setAspectRatio( (Ogre::Real)mViewport->getActualWidth() / (Ogre::Real)mViewport->getActualHeight() );

// Sound Manager must be created before any scenes, as they get singleton of Sound Manager
mSoundManager = new OgreAL::SoundManager();

// This function creates all the various managers behind PLSM2, so this call is required
// Current map is set to None
mSceneManager->setWorldGeometry( Ogre::String("paginglandscape2.cfg") );


Current Map is actually not set to None at this time:
DefaultMap=Terrain_Scene_Manager_Terrain

The creation of the camera is pretty much this code:

mSceneManager = CurrentSceneManager;

mCamera = mSceneManager->createCamera(mName);
mCamera->setAutoAspectRatio(true);
mCamera->setNearClipDistance(1);

// Camera Setup
mCamYawNode = mSceneManager->getRootSceneNode()->createChildSceneNode(mName + "CamYawNode",Ogre::Vector3(0,0,0));
mCamPitchNode = mCamYawNode->createChildSceneNode(mName + "CamPitchNode");
mCamPitchNode->attachObject(mCamera);


It's basically just a yaw node, with a child pitch node, with the camera attached.

This makes no send to me.. please help :cry:

KungFooMasta

Grom

24-02-2007 20:42:02

This isn't really specific to PLSM. It sound likes your OIS mouse stuff is done improperly.

kungfoomasta

24-02-2007 20:48:05

It all worked with TSM... I just dropped in PLSM2 since I heard its eihort compatible.

I'm actually using Windows Forms mixed with native C++, so the input is all done via MS code handlers. I can verify that keys and mouse movement is registered properly. Calls to SceneNode::yaw and Camera::yaw seem to do nothing. Strange enough, this only happens to the scene nodes with the camera attached. I can place other objects in the scene and yaw them.

Grom, can you post the order of your setup to help me out?

-PLSM2 SceneManager creation
-Camera creation
-Viewport Creation
-Loading Terrain

What order do you have yours in?

KungFooMasta

Grom

24-02-2007 21:05:58

sceneMgr = root->createSceneManager(ST_EXTERIOR_REAL_FAR, "MyScene");
cam.create(sceneMgr, "PlayerCamera");
viewPort = root->getAutoCreatedWindow()->addViewport(cam.getCamera());
sceneMgr->setWorldGeometry("paginglandscape2.cfg");

kungfoomasta

24-02-2007 21:06:49

Interestingly enough, I got rid of my scenenode camera system and I can now pitch and yaw. . .

Grom, is your camera attached to a scene node? AFAIK, camera doesn't support translation, so attaching to scene nodes would seem very helpful. And if you don't have a separate node for pitch/yaw, won't you end up with Euler angles when changing pitch/yaw or camera?

KungFooMasta

kungfoomasta

24-02-2007 21:29:35

I got it all working now. I don't know the problem... but I blew away my camera class and just made 2 scene nodes with a camera attached and it works...

KungFooMasta

Grom

24-02-2007 21:47:09

I use a system with the camera attached to a Pitch Node attached to a Yaw Node attached to a CameraNode.