Try this:
import pymel.core as pm
sphere = pm.PyNode("pSphere1")
sphereM = sphere.worldMatrix.get()
sphereInvM = sphereM.inverse()
sphere.setMatrix(sphereInvM * sphereM)
On Tue, Jul 31, 2012 at 5:31 PM, meeotch <[email protected]> wrote:
> Hopefully someone can tell me how I'm screwing this up...
>
> 1) create a sphere, translate it away from the origin
> 2) m = PyNode("pSphere1").worldMatrix.get()
> 3) v = PyNode("pSphere1").translate.get()
>
> So far, so good - m looks like a reasonable matrix, v is the position of
> the sphere. So now:
>
> 4) m.inverse() * v (or maybe the other way around)
>
> Shouldn't that give (0,0,0) ? I.e., transforming the position back to the
> origin. Or is matrix*vector multiplication not implemented?
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe