[Closed] How to use add_path in Path Constraint?
I’m a little stuck here (too much scripting to learn in one day).
What’s a practical example of this syntax?
.path UndefinedClass default: undefined – node; Path_Constraint
Add Path: is used to add a new spline path that influences the constrained object.
Delete path: is used to remove a path from the target list. Once removing the path target, it will no longer influence the constrained object
I can use:
mybox01.pos.controller.follow = on
to set a Path_Constraint controller’s follow, as well as axis or any of the other “simple” properties. But I can’t figure out how to add a path to it.
mybox01.pos.controller.path = #add_path:$line01
doesn’t work, nor do any of the dozens of variations I’ve tried. I know I just don’t understand this, but please point me in the right direction.
Mike,
Here’s the method for adding paths to a Path Constraint controller:
mybox01.pos.controller.appendTarget $Line01 50
where 50 (default) is the weight to use for the added path.
To remove a path from the controller use:
mybox01.pos.controller.deleteTarget 1
where 1 is the index of the path.
Check out the “Path_Constraint : PositionController” topic in the mxs reference for more information.
Cheers,
Martijn
mybox01.pos.controller.path = $line01
-- sets the path for the controller to line01
-- replaces the path list with the specified path
.appendtarget adds a new path to the list.
This is listed in the interface section of the path_constraint help.
mybox01.pos.controller.appendtarget $line02 50
-- adds line02 to the path list with a weight of 50
-Eric
Thanks guys – that does work, but the Max 9 Maxscript documentation does not mention a word about “appendtarget” in Path Constraint. Instead it keeps referring to AppendPath or DeletePath, so I’m guessing either the docs got screwed up or I just don’t see something obvious.
But the quick response is much appreciated – now I have my Biped footsteps to path working a treat.
Check the Path_Constraint interfaces at the bottom of the page. The Add Path and Delete Path in the .path section is wrong.
<boolean>appendTarget target weight
Appends the specified node to the list. The default weight is 50.0. Returns True on success, False otherwise.
<boolean>deleteTarget targetNumber
Delete the indexed target. Returns True on success, False otherwise.
-Eric