Notifications
Clear all

[Closed] Macros.run problem with Position Constraint

Hey guys, another problem to help one of our artists.

He’s trying to make an easier way to create a Position constraint;

He picks one object, then selects Animation->Constraints->Position Constraint, then picks the other object to use.

However, if I try to run this as this:

select $Bone_Foot3_RD
macros.run “Constraints” “Position_Constraint”
select $Bone_Foot3_R

it won’t do it by itself, and still asks me for the second object, or the $Bone_Foot3_R by hand.

Is there anyway to automate this?

Thanks!

3 Replies

wouldn’t the two objects depend on the artist’s input, and thus not readily be something you would automate?

Regardless, the way to go about it is by manually setting up the controller.


a = $GeoSphere01
$GeoSphere:GeoSphere01 @ [159.702484,264.971313,0.000000]
b = $GeoSphere02
$GeoSphere:GeoSphere02 @ [159.702484,264.971313,0.000000]

a.position.controller = Position_Constraint()
Controller:Position_Constraint
a.position.controller.appendTarget b 0.5
true

Note that this will make the position constraint the main position controller. If you go via the UI, it will place the position constraint within a Position List; you can do much the same with some more scripting if that’s needed.

Thanks worked great! You should write your own maxscript book

And I know, I was shocked when he asked me to help him with that script as well.

But, I guess he does the same thing but on different models each time, w/ the same name for objects.

Little by little, I’ll be able to help anyone here (where I work that is heh) with maxscript problems as well I hope

Well, that’s certainly commendable of the artist… having a consistent setup, especially for rigging (what this sounds like) is a Good Thing™