Align objectA center to $object center, non pivots?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  04 April 2012
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?
  04 April 2012
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
Scripting and Rigging Reel 2012 - Open for full-time position or freelance work
  04 April 2012
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

"The Evil Monkey hiding in your closet."
  04 April 2012

$ = $
  04 April 2012
Thanks All!!

Originally Posted by denisT:

$ = $

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.

Is there any downfalls to this method? Does it work with most other versions of max?

Last edited by Opifex : 04 April 2012 at 10:27 PM.
  04 April 2012
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:45 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.