[Closed] Align objectA center to $object center, non pivots?
I cant seem to find out how to align an object by the name of “A”, to the selected object using maxscript unless both pivots are centered.
So how would I go about aligning an object with a specific name to the selected object regaurdless of pivots.
I know I could a.position = selection.position as long as both ojects have the pivots centered, but how can I achieve the same results without changing the pivots?
Hi there,
See maxscript manual for more information, but there is a center property. Use it to calculate offset between pivot and this center property to place you object’s center to other objects center.
Something like this (in it’s simplest form)
sOffset = $sphere.center – $sphere.pos
$sphere.pos = $teapot.center
$sphere.pos -= sOffset
Here is a thread about node transform properties: Get Local transform in Maxscript
I would figure out the difference from center to center and move the first object that distance. You need to calculate it from destination minus source, and move the source that distance.
dst = $
src = $'A'
objMove = dst.center-src.center
move src objMove
or
dst = $
src = $'A'
objMove = dst.center-src.center
src.pos += objMove
-Eric
Thanks All!!
This looked like the simplest way so I used this and it works perfect!
Kind of makes me feel dumb since its pretty much my title. :shrug:
Is there any downfalls to this method? Does it work with most other versions of max?