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
Occulis
Halfling
Posts: 91
Joined: Tue Mar 29, 2005 7:29 pm
Location: Houston, TX
Contact:

Snippet: Rotating without tilting

Post by Occulis » Sun Apr 03, 2005 3:42 pm

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.
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Post by sinbad » Sun Apr 03, 2005 6:32 pm

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

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

Post by joshcryer » Sun Apr 03, 2005 10:40 pm

Thanks for the cute snippet Occulis, here's a link to the wiki where you can add that one, and more if you like: http://www.ogre3d.org/wiki/index.php/CodeSnippits

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

Post Reply