Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Set the pivot of an object to match the pivot of another object?

Set the pivot of an object to match the pivot of another object?

wyomingstateflag
Contributor Contributor
217 Views
3 Replies
Message 1 of 4

Set the pivot of an object to match the pivot of another object?

wyomingstateflag
Contributor
Contributor

Setting the transformation of the pivot point of an object to match the pivot of another object seems like something that should be trivial to do. I know position is as easy as object1.pivot =object2.pivot which I expected to get and set the pivot transformation but sadly only handles position.

0 Likes
Accepted solutions (1)
218 Views
3 Replies
Replies (3)
Message 2 of 4

dmitriy.shpilevoy
Collaborator
Collaborator

Depends on what you are trying to do.

Do you want to align obj1 by obj2 position and rotation or only align its pivot, leaving mesh as it was?

If former - use 

object1.transform = object2.transform

Message 3 of 4

A娘
Advocate
Advocate
Accepted solution

you mean you want to set A's point overlaps B's point , then this was 3D math , you should calculate new transform offset of A

fn AlignPivotA2B A B =
(
	newtransformoffset = A.objecttransform * inverse B.transform
	A.objectOffsetRot = newtransformoffset.rotationpart
	A.objectOffsetPos = newtransformoffset.translationpart
	A.objectOffsetScale = newtransformoffset.scalepart
	A.transform = B.transform
)

call the function , and A will be set pivot align to B

Message 4 of 4

wyomingstateflag
Contributor
Contributor

Perfect, thanks so much!

0 Likes