[Closed] Scripted reactions Woe's
Hi All,
so ive been trying to script a foot roll reaction. with standard paul Neale foot roll setup. having played abit with scripting reactions i have found it a mistical entity with what seams to be wierd bugs with creation order of reactions. it seams to me that the first 3 reaction states seam to randomly reorder its number and then after that its locical.
so firstly when you declare
reactTo MyReaction MyController
it creates the first reaction automatically which would mean it should be reaction “1”
then on every declaration of
createReaction MyReaction
it should create reaction “2”
then “3” etc…
instead it creates the order in this way buy pushing the creation back one number so after the 3rd reaction it numbers it this way
1st created = 3
2nd = 2
3rd = 1
which seems fine except once you create the 4th it ends up being the forth
4th created = 4 instead of creating the 4th as 1 and reordering the rest
um… hope this hasnt confused people. bascically instead of it puttin the next creating in the front and pushing the others back a number like it did with the 1st 3 its changes and puttinh the 4th on the back.
my second problem is
when you have 2 varables in the reation state. it seems that you are unable to create reaction this way so you need to create individual reactions for each object in the reaction.
is there anyway of merging reactions?
what is confusing in the maxscript referance is the dicription of how things should be done eg there are functions like. “selectreaction”
should you be selecting the reaction and the applying changes?
it seams that all functions are accessing reactions by its creation order number. obviously this is where i am hitting problems
also if you do have 2 objects in the reation state you can not access the second object within that state. wired! also you can only add this manually
has anyone attmented to do this as i feel that there has been a lack of thought gone into the scripting access of reactions. somthing that would and should be a pritty important thing to do by automation.
anyway anybody experianced any problems? or have i just confused everyone!
here is my script. unfortunally i cant give you the file unless you email me.
--MyBone2 = $bone27
MyCtrl = $Circle01
MyR = MyBone.rotation.controller.Zero_Euler_XYZ.controller.Z_Rotation.controller = Float_Reactor ()
MyC= MyCtrl.modifiers[#Attribute_Holder].footControls.footRoll.controller
--Creates the reaction controller
reactTo MyR MyC
-- create 1st reaction Number 1 by default
--is actually ends up reation 3
slidertime = 5f
-- create reaction Number 2
createReaction MyR
slidertime = 10f
-- create reaction Number 1
createReaction MyR
slidertime = 15f
-- create reaction Number 4
createReaction MyR
slidertime = 20f
-- create reaction Number 5
createReaction MyR
slidertime = 0f
--set state values
setReactionName MyR 3 "footRollZstate"
--set state values
setReactionName MyR 2 "footRollHBstate"
setReactionState MyR 2 (degtoRad -10)
--set state values
setReactionName MyR 1 "footRollBstate"
setReactionState MyR 1 (degtoRad -25)
--set state values
setReactionName MyR 4 "footRollHFstate"
setReactionState MyR 4 (degtoRad 10)
--set state values
setReactionName MyR 5 "footRollFstate"
setReactionState MyR 5 (degtoRad 25)
--then print the reaction name by number to check
getReactionName MyR 1
getReactionName MyR 2
getReactionName MyR 3
getReactionName MyR 4
getReactionName MyR 5
here is the script if i want a foot roll by individually having reactions for each object. which is an odd way of doing things.
MyBone = $bone26
MyBone2 = $bone27
MyCtrl = $Circle01
MyR = MyBone.rotation.controller.Zero_Euler_XYZ.controller.Z_Rotation.controller = Float_Reactor ()
MyR2 = MyBone2.rotation.controller.Zero_Euler_XYZ.controller.Z_Rotation.controller = Float_Reactor ()
MyC= MyCtrl.modifiers[#Attribute_Holder].footControls.footRoll.controller
--Creates the reaction controller
reactTo MyR MyC
reactTo MyR2 MyC
-- create 1st reaction Number 1 by default
--is actually ends up reation 3
slidertime = 5f
-- create reaction Number 2
createReaction MyR2
slidertime = 10f
-- create reaction Number 1
createReaction MyR2
slidertime = 15f
-- create reaction Number 4
createReaction MyR
slidertime = 20f
-- create reaction Number 5
createReaction MyR
slidertime = 0f
--set state values
setReactionName MyR 1 "footRollZhealstate"
setReactionName MyR2 3 "footRollZtipstate"
--set state values
setReactionName MyR2 2 "footRollHBstate"
setReactionState MyR2 2 (degtoRad -30)
--set state values
setReactionName MyR2 1 "footRollBstate"
setReactionState MyR2 1 (degtoRad -60)
--set state values
setReactionName MyR 2 "footRollHFstate"
setReactionState MyR 2 (degtoRad 30)
--set state values
setReactionName MyR 3 "footRollFstate"
setReactionState MyR 3 (degtoRad 60)
--then print the reaction name by number to check
getReactionName MyR 1
getReactionName MyR 2
getReactionName MyR 3
--getReactionName MyR 4
--getReactionName MyR 5
cheers
john
Dude I´m struggling with this issue too, actualy I ended doing the foot roll via wire parameters.
But I´m curious about how to do it in maxScript.
well it seems that theres not much i can do to get this to work there are afew bugs in the reaction manager and also there is no way of access or creating more thean one object within a state. unfortunate really.
i think wire paramiters is not a bad way to go for these simple things.
ah well i gave it a go.
still if anyone can can tell me otherwize then that would be great.
cheers
john
Hi, I am writing a scripted version of the Leg rig on the CG Academy DVDs, and came across the same issue about scripting reaction controllers. I found it worked for me if I set state and value backwards, like this:
createReaction ballReactor
createReaction ballReactor
setReactionState ballReactor 3 0.0
setReactionValue ballReactor 3 90.0
setReactionState ballReactor 2 (degToRad 45)
setReactionValue ballReactor 2 45.0
(the 1 reaction seems to be set automatically, so I ignore it)
I hope that can solve your problem
hey man sorry to break this to you but. sripting reactions for one reaction is fine. but autodesk isnt going to fix this anytime soon. you dont have acsees to the 2-Nth reaction state. so you can do it but you have one state per reaction . your better of doing it with wire parameters. if its fingers or a foot roll than thats not to hard.
cheers
john
Shame it doesn’t work properly, yeah. Wired and expression connections are excellent, but for some connections a proper scriptable reaction controller would be more ideal. Especially in those cases where you have to go through a more curve like response to a value. My scripting background is from Maya, and the way you can set up driven keys is just so elegant and simple. I hope a future version will have this fixed…