[Closed] CSolver Simple Problem
Hello
This is realy simple but I can no longer see the wood for the trees.
I am putting together a quick script that adds a bunch of point constraints to a selection of object. I can do this bit fine. However I want to add the point constraints to the Constraint Solver. The syntax in the manual says <boolean>[font=‘Courier New’]AddConstraint <node>newConstraint [font=Verdana]No matter what I try and do I cannot get this to work. Can someone give me a quick sample of how to add a constraint to a solver using this code?[/font][/font]
Thanks
Harry
Or are you looking at the Reactor Dynamics max script access help. That is the only place that I can find the line that you are describing in the help.
If it is and you are looking for position constraint instead then need to look up just that.
Hi Paul
I am trying to add a Reactor Point_Point() constraint to a CSolver() Constraint solver. This is part of a script to help facilatate the automation of setting up a reactor based animation.
It is all maxscript and not SDK.
Thanks
Harry
Ok Still stuck but got a little further. It seems that the addconstraint method is similar to the addmodifier method. However I do not understand the <boolean> argument it is asking for. Has anyone ever used this method or is there a better way to add the reactor objects to the solver?
Thanks
Harry
Ok Been trying all day now and the syntax is alluding me.
Where’s Bobo hiding
Harry
I believe that means the method returns a boolean if it was successful. Could be wrong.
Hi MoonDoggie
I thought that however the method specifies <boolean>AddConstraint <node>newConstraint [font=Verdana]so I presumed that it was similar to the addmodifier method. However when you try and use like an addmodifier it returns a “Wanted 4 got 2” error. Now I assume that this the number of arguments that the method requires. However in the manual it only seems to specify 2. So I am a little stuck.[/font]
Thanks
Harry
Hi Harry,
I’ve never used Reactor, but I thought I’d have a fiddle. This worked for me; am I missing your point?
c = CSolver()
p = Point_Point()
c.addConstraint p
Hi Dave
This is exactly what I was trying. Here is the script in its early dev stage. You can see the very same code at the bottom . I have commented it for ease. This returns the error
– Argument count error: AddConstraint wanted 4, got 2
Any Ideas?
(
MyRBCol = RBCollection()
MyRBCol.name = “MyRigidBody_Solver”
MyCSolver = CSolver ()
MyCSolver.name = “MyConstraint_Solver”
MySelection = Selection as array
Local MyParent = $lamp
For i = 1 to Myselection.count do
(
MyObj = Myselection[i]
MyObj.parent = MyParent
MyPCont = Point_Point()
MyPCont.name = (MyObj.name + “_PointConst”)
[size=2]MyPcont.Childbody = MyObj
MyPcont.hasparent = true
MyPcont.parentbody = MyParent
MyCSolver.rbCollection = MyRBCol
Addconstraint MyPcont MyCSolver – addconstraint line
)
)
Thanks
Harry
[/size]