Skip to main content

History: RotateYawOnly

Source of version: 4 (current)

Copy to clipboard
            __Note:__ This assumes ''sn'' is your (SceneNode*) and ''mDestination'' holds the location your ''sn'' is trying to go to.

{CODE(wrap="1", colors="c++")}
Vector3 vecModifiedDest = mDestination, vecCurrentPosition;

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

sn->lookAt(vecModifiedDest, Node::TransformSpace::TS_LOCAL, Vector3::NEGATIVE_UNIT_Z);{CODE}

__Note__ (to GCC users): When refering to the TransformSpace you want to use, you may get "Node::TransformSpace is not a class or namespace" errors. This is because you are supplying an enumeration value. Strictly, you should not qualify it with enumeration name itself. I believe other compilers may look over this. If this problem occurs, replace the problematic argument with this:

{CODE(wrap="1", colors="c++")}Node::TS_LOCAL{CODE}