View Full Version : Align objectA center to $object center, non pivots?

04 April 2012, 09:00 AM
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?

04 April 2012, 10:02 AM
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.pos
$sphere.pos = $
$sphere.pos -= sOffset

Here is a thread about node transform properties: Get Local transform in Maxscript (

04 April 2012, 12:52 PM
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 =
move src objMove
dst = $
src = $'A'
objMove =
src.pos += objMove


04 April 2012, 02:08 PM
$ = $

04 April 2012, 08:04 PM
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?

CGTalk Moderation
04 April 2012, 08:04 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.