Home Technical Talk

Maya center pivot to world

polycounter lvl 19
Offline / Send Message
MikeF polycounter lvl 19
Never had much of a use for something like this until today so i figured i'd throw it out there.
Say i've got a cube centered at 0,0,0 in world coordinates and then i want to rotate an object around the center origin to align evenly with each face, is there quick way of doing this?

essentially i want to set the pivot of an object to a target objects center point.

i could do some attach/detach workaround but if anyones got a better suggestion please share, thanks!

edit: another method i've used in the past is to create a sphere at 0,0,0 and snap the pivot to top vertex
edit2: and as i re-read this, i realiese that i've forgotten about snap to grid, so thats solved.
still curious if there's a way to center the pivot to a target object, could be useful

Replies

  • Gyrfal
    Options
    Offline / Send Message
    If you just need it to rotate it around an object you can select the object to pivot around, select the object to rotate then parent constrain (maintain offset). You can then rotate the pivot object and that'll rotate the other object around it. You have to go to the hierarchy afterwards to delete the constraint and zero out the rotation on the pivot object, but it's a precise way that should work for any forms.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    great idea, thanks man, should come in handy
  • couette
    Options
    Offline / Send Message
    There are a couple of other ways to snap one object's pivot to another object's pivot.

    From the Display->Transform Display menu, you can toggle the visibility of an object's pivot. When it's visible, you can point snap to it.

    Or, if this needs to be done frequently, it can be done via mel. I'm not very savvy with mel, so there may be a better way to accomplish this.
    {
      string $obj[] = `ls -sl`; 
      float $np[] = `xform -q -ws -piv $obj[1]`;
      xform -ws -piv $np[0] $np[1] $np[2] $obj[0];
    }
    
    First select the object to be modified, then select the target object.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    awesome, thanks a lot couette
Sign In or Register to comment.