Snippet: Rotating without tilting

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
Posts: 91
Joined: Tue Mar 29, 2005 7:29 pm
Location: Houston, TX

Snippet: Rotating without tilting

Post by Occulis »

This assumes 'sn' is your (SceneNode *) and 'mDestination' holds the place your sn is trying to go.

Warning: Only tested with ninja.mesh

Code: Select all

Vector3 vecModifiedDest = mDestination, vecCurrentPosition;

vecCurrentPosition = sn->getPosition();
vecModifiedDest.y = vecCurrentPosition.y;

sn->lookAt( vecModifiedDest, Node::TransformSpace::TS_LOCAL, Vector3::NEGATIVE_UNIT_Z);
If there are better snippets out there, feel free to post them. Hope this helps someone.

User avatar
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 65

Post by sinbad »

Please post code snippets in the Wiki rather than the forums; tips here will get lost in the deluge of threads over time.

User avatar
Posts: 351
Joined: Wed Oct 13, 2004 8:22 am

Post by joshcryer »

Thanks for the cute snippet Occulis, here's a link to the wiki where you can add that one, and more if you like:

Not to bump this thread, but it should die soon enough.

Post Reply