# Performing translation after rotation on object

I'm working in Maya and I have a light object. When I rotate my light object on the origin my manipulator rotates with object. However, as soon as I translate the light object (no longer at origin), my manipulator goes in some other direction. If I move the light object back to the origin, the manipulator will return to back to the correct spot.

The code does two things:

1. It will get the translation of the light object's transform and set the manipulator's translation to that. I've debugged and checked the values and it does set it to the correct values
    MFnDagNode dagFn(fNodePath);
MDagPath path;
dagFn.getPath(path);
path.pop();
MFnTransform transformFn(path);
return transformFn.getTranslation(MSpace::kWorld); // a vector

1. It gets the transform's rotation quaternion and sets the manipulator's rotation to that
    MFnDagNode dagFn(fNodePath);
MDagPath path;
dagFn.getPath(path);
path.pop();
MFnTransform transformFn(path);
MQuaternion q;
transformFn.getRotation(q, MSpace::kTransform);
manipFn.setRotation(q);