[Solved] Problem with camera Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
saintnick
Halfling
Posts: 51
Joined: Tue Nov 27, 2018 1:41 am
x 2

[Solved] Problem with camera

Post by saintnick » Wed Jan 23, 2019 2:35 pm

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.
Last edited by saintnick on Thu Jan 24, 2019 10:11 pm, edited 1 time in total.
0 x

User avatar
saintnick
Halfling
Posts: 51
Joined: Tue Nov 27, 2018 1:41 am
x 2

Re: Problem with camera

Post by saintnick » Thu Jan 24, 2019 10:11 pm

Code: Select all

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

Post Reply