Camera auto tracking and getting camera derived orientation

Problems building or running the engine, queries about how to use features etc.
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Camera auto tracking and getting camera derived orientation

Post by alberts »

Hi all,

I’m trying to maintain the same camera orientation when switching from other camera modes to “Free” camera mode in CCS. The problem has to do with the camera modes that use auto tracking. When switching to “Free” mode from a camera mode that uses auto tracking I’m not able to retrieve the current camera orientation. As reported in this thread, I always get the IDENTITY quaternion as the derived orientation of the camera (Ogre::Camera). I have tried to disable auto tracking before and after trying to get the derived orientation but it does not work. I have also tried to manually update the parent node of the camera but the problem still persists. Is there any solution or work around?

Thanks in advance.
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Camera auto tracking and getting camera derived orientat

Post by Waruck »

Maybe your camera is connected to a scene-node and only stores its relative orientation to the scene node which is the identity? In that case try to get the derived orientation of the scene-node
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera auto tracking and getting camera derived orientat

Post by alberts »

Thanks Waruck for your help but that's not the problem. The derived orientation of the scene node has the same problem.

I've finally have decided to manually calculate the direction of the camera when switching from a camera mode using auto traking. It works with the "Free" camera mode because the exact orientation is not really needed (just the direction) but the issue is still there in Ogre. I can live with that :) .
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Camera auto tracking and getting camera derived orientat

Post by Waruck »

have you tried using Camera::getRealOrientation() ?
If that also don't work: I don't know much about the ccs but it's also possible to change the direction of the camera, to look in a different direction, without changing the orientation.
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera auto tracking and getting camera derived orientat

Post by alberts »

Waruck wrote:have you tried using Camera::getRealOrientation() ?
Yes. I also get the identity quaternion.
Waruck wrote:If that also don't work: I don't know much about the ccs but it's also possible to change the direction of the camera, to look in a different direction, without changing the orientation.
Please elaborate. How do you change the direction of a camera without changing its orientation?
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Camera auto tracking and getting camera derived orientat

Post by Waruck »

Ok, sry. This was a fault on my side. I thought Camera::setDirection() wouldn't rotate the camera but after looking at the source file I found myself wrong.

You could try Camera::getRealDirection(), but I doubt this would give you anything else than the global z-axis if the orientation is the identity quaternion.

The last thing that comes to my mind is that the scene's root node can be moved and rotated instead of the camera. You can try checking whether SceneManager::getRootSceneNode()->getOrientation() also gives you the identity quaternion.

If this doesn't help one has to look into the ccs code and look how the cameras are moved and rotated.