Page 1 of 1

[Solved] Problem with camera

Posted: Wed Jan 23, 2019 2:35 pm
by saintnick
Ogre Version:1.11 :?:

I have implemented a simple third person camera that works with the Razor model. Now I am trying to make it work with the Robot model and have a problem.

Code: Select all

							Vector3 newCamPosition = mNode->getOrientation() * Vector3(0, 0, 500) * Vector3::UNIT_Z;
							mNode->addChild(camNode);
							camNode->setPosition(newCamPosition);
When activating this code it puts me behind the Razor model 500 units. I have rotated the Robot model to match the orientation of the Razor but when I try to activate the third person camera it isn't positioned behind the Robot but to the side. I am pretty sure the Robot mesh's starting position is the culprit but I don't know how to account for it.

I tried this

Code: Select all

							Vector3 robotCorrection = mNode->getOrientation() * Vector3::UNIT_X;
							Vector3 newCamPosition = robotCorrection * Vector3(0, 0, 500) * Vector3::UNIT_Z;
							mNode->addChild(camNode);
							camNode->setPosition(newCamPosition);
There was no noticeable change.

Re: Problem with camera

Posted: Thu Jan 24, 2019 10:11 pm
by saintnick

Code: Select all

Vector3 newCamPosition = mNode->getOrientation() * Vector3(-500, 0, 0) * Vector3::UNIT_X;
This gives a camera position behind the robot.