Maya – Aligning the center of one object to the center of another object

Viewed 428

I’m an animation student and this is the first time I study programing and Python.

My doubt is the following: I have two objects in a maya file: “pSphere1” and “pCone1”, and I want to place the pSphere1 center at the center of pCone1, (by center I mean pivot; I want both pivots to be aligned). pSphere1 is the one that should move to the position of pCone1. pCone 1 doesn’t move.

So, I was wondering if there is a command in Python that can center both object’s pivots.

1 Answers

At first select pSphere1, then pCone1 and apply the following command:

import maya.cmds as mc

mc.align(x='mid', y='mid', z='mid', alignToLead=True)

Flag alignToLead=True produces the desired result.

Related