Visualise Orientation of camera Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
Posts: 7
Joined: Wed Nov 28, 2018 10:15 am

Visualise Orientation of camera

Post by andreas » Thu Mar 07, 2019 9:38 pm

Ogre Version: :1.11.4:
Operating System: :ubuntu 16.04
Render System: :?:

Hello, I am working on a project, but I have some problems with setting my orientation. It would be a great help if I can visualize my cameras orientation. But how do I do that?
0 x

Posts: 151
Joined: Wed Mar 18, 2009 3:03 am
x 16

Re: Visualise Orientation of camera

Post by rpgplayerrobin » Thu Mar 07, 2019 10:25 pm

What problem do you have exactly?

If you want to visualize the orientation of a camera, I guess it is not your main camera, as the main cameras orientation is shown anyway in your view.
To visualize the orientation/position of another camera, you could just create 3 entities and nodes and place them at the cameras position, but offset it with its orientation, like:

Code: Select all

static SceneNode* node1 = NULL;
static SceneNode* node2 = NULL;
static SceneNode* node3 = NULL;
String meshName = "barrel0.mesh";
float offset = 0.5f;
Vector3 scale = Vector3(0.1f, 0.1f, 0.1f);
if (!node1)
	node1 = app->m_SceneManager->getRootSceneNode()->createChildSceneNode();
	node2 = app->m_SceneManager->getRootSceneNode()->createChildSceneNode();
	node3 = app->m_SceneManager->getRootSceneNode()->createChildSceneNode();

	Entity* ent = app->m_SceneManager->createEntity(meshName);

	ent = app->m_SceneManager->createEntity(meshName);

	ent = app->m_SceneManager->createEntity(meshName);
node1->setPosition(app->m_Camera->getDerivedPosition() + (app->m_Camera->getDerivedOrientation().xAxis() * offset)); // Right
node2->setPosition(app->m_Camera->getDerivedPosition() + (app->m_Camera->getDerivedOrientation().yAxis() * offset)); // Up
node3->setPosition(app->m_Camera->getDerivedPosition() + (-app->m_Camera->getDerivedOrientation().zAxis() * offset)); // Forward
Run this code every frame.
Replace "barrel0.mesh" with any mesh you have and play with the scale/offset variables.
1 x

Posts: 7
Joined: Wed Nov 28, 2018 10:15 am

Re: Visualise Orientation of camera

Post by andreas » Fri Mar 08, 2019 11:06 am

Yes, I was looking for something like that thanks!
0 x

Post Reply