Notifications
Clear all

[Closed] Scale/Rotate a child around the parents pivot point???

I am looping through a collection of selected geometry and performing a scale/rotate on each object prior to doing a bunch of stuff for exporting it…

One of the modifiers is for rotating the object around a pivot…I’m using a point helper as a child of that object to specify the pivot for the animation modifier…since the objects actual pivot for export needs to be the same as the others (basically the object will have an actual pivot (usually 0,0,0), and a point helper specifies the pivot to be used by the exported-to program)

So…when I get to the object with the rotation modifier, I get the .pivot of the point helper that is its child and use that as the reference…BUT…it needs to be scaled and rotated to follow the parent…but it needs to be rotated around and scaled by the same actual pivot point of the parent…

Is this possible? Do I need to provide a screenshot of what I’m talking about?

16 Replies
 PEN

Check out

in coordsys

Doesn’t seem to work…its performing the rotate and scale, but it seems to be doing it around its own pivot still.

Thanks for all the help btw.

According to those docs…thats the same as the reference coordinate system in the dropdown…which is fine…but what I need is to set the pivot point center for the operation to that of the parent…I think if I were going to do this in the interface without script, I would actually have to set a working pivot equal to the parents pivot, and then perform the operation…make sense?

Would <node>.objectOffsetPos do it?

I just did something like this for my animate align tool, if this isn’t solved by Monday, ping me again and I’ll look at how I did it and give you a suggestion.

Basically, I made it so a slave object can be animated aligned ‘as child’, which is what you need to do, I think- position/rotate/scale around an arbitrary point.

 eek

You need to get the transform space of the object relative to a reference system namely the point in your case.

tm = $object.transform * inverse $point.transform

Then you would multiply this transform about a matrix:

$object.transform = tm * $point.transform

if you wanted it to rotate about a arbitrary matrix you could do:

(tm * (eulerangles (0 90 0) as matrix3)) * $point.transform

Remember you using a reference coordinate system i.e , its using the ‘about’ methodology. With this method position, can be classed as a magnitude from the origin – and is a good aproach to scaling rigs e.g.

tm = $point.transform * base.transform – get the base reference system

finalTm = base.transform
finalTm.row4 = base.transform.row4 * 0.5 – scale ammount

$point.transform = tm * finalTm

or

$point.transform * (base.transform * 0.5)

Thanks Prof420 and eek!

I can’t try this yet because I’ve switched from having the pivot as a child to using a pickbutton to select the pivot, and the selected pivot isn’t staying as the selected pivot…gotta figure out how to have the .obj of the pickbutton on the simplemod saved with the other parameters of my simplemod…

In your example there, is $object the object to be rotated/scaled and $point the point that I want to rotate/scale it around or vice/versa?

 eek

try(destroyDialog testAlign)catch()
(
local tmSpace = undefined
local objSpace = undefined rollout testAlign
(
pickbutton pickPivot “Pick Pivot”

Spinner rotX “X:” range:[-180,180,0]
[indent] on pickPivot picked obj do
(
tmSpace = selection[1].transform * inverse obj.transform
objSpace = obj
pickPivot.text = obj.name
)
on rotX changed val do
([indent] if tmSpace != undefined do
(
[/indent][/indent]selection[1].transform = tmSpace * ((eulerangles val 0 0) as matrix3) * objSpace.transform
[indent][indent] )
)
[/indent])
createDialog testAlign
[/indent])

roughly something like this – i get confused on the order of matrix multiplication and im not at my desk atm.

Just tried running your script and I get a really weird error…

undefined
– Error occurred in anonymous codeblock; filename: C:\Program Files\Autodesk\3ds Max 2009\Scripts ransformtest.ms; position: 402
– Syntax error: at on, expected while
– In line: on r

This is referring to the “on rotX changed val do” line…

I searched google and found two instances of this error, and they both go unexplained…

Page 1 / 2