[Closed] basic script syntax
This sort of problem has been driving me nuts for years.
I have a spring position controller, and the documentation shows that I can access its properties through methods, getMass, setMass, getDrag, setDrag, etc., but offers no clue on how to actually use these methods. “Interface: Spring” doesn’t tell me jack. I would think it something comparable to “getmass $.position.controller.spring” which is all they would have to put in the documentation to make it clear, to show how it’s used. I’ve run into this so many times and I still just don’t get how they expect you to guess the proper usage.
the functions you describe are function of the controller, your example tries to run the function on the controller.
instead of :
myFucntion myController
which passes the controller as an argument to the myFucntion
you want
myController.myFucntion()
welcome to Max Script documentation. I find max’s animation controllers to be one of its more frustrating things to deal with. A single page covering they need to be dealt with would be invaluable to anyone coming to max script. – especially how you should access them once they are created.
(
b=box() --make obejct
b.pos.controller=SpringPositionController() --assign controller
b.pos.controller.getMass() --access the controller's function
--you could create a variable to point at the spring controller for simpler access
mySpring =b.pos.controller
mySpring.getMass()
--it gets complex if you have a list controller (as when you 'freeze transform' ,for example)
--you then must access controllers as part of an array of subAnim objects.
b2=box() --make object
b2.pos.controller = Position_list() --assign List controller
b2.pos.available.controller = SpringPositionController()--assign spring controller to availale subanim in the list
--now you have to access the controller as an item in the Subanim array
b2.pos.controller.Spring --by object Name
b2.pos.controller[#Spring] --by array name
b2.pos.controller[2] --or by index number
b2.pos.controller.Spring.getMass() --access the controller's function
)
A an * easily found* example like the above would be super helpful in the max script docs.