Reactor controller
The Reactor controller is a procedural controller that reacts to changes in any other
controller within the software.
Reactor comes in five different forms: Position Reactor, Rotation Reactor, Point3
Reactor, Scale Reactor, and Float Reactor.
Any animatable parameter in the software can react to changes in any other animatable
parameter. Reactor is not based on time, but is based on other variables in your scene.
EXAMPLE
|
-- Setup a scene
ball = sphere name:"ball"pos:[-40,0,50] radius:10
ball.pos.controller = position_XYZ()
-- create some keys
key = addNewKey ball.pos.Zposition.controller 0
key.outTangentType = #slow
key.value = 50
key = addNewKey ball.pos.Xposition.controller 0
key.value = -40
key = addNewKey ball.pos.Zposition.controller 25
key.InTangentType = #fast
key.outTangentType = #fast
key.value = 4
key = addNewKey ball.pos.Xposition.controller 25
key.value = -10
key = addNewKey ball.pos.Zposition.controller 50
key.InTangentType = #slow
key.value = 50
key = addNewKey ball.pos.Xposition.controller 50
key.value = 20
ball.showtrajectory = true
-- assign a reactor controller to the scale of the ball
reactorCtrl= Scale_Reactor()
ball.scale.controller = reactorCtrl
-- Pick the react to object, and create reactions
reactorCtrl.reactions.reactTo ball.pos.ZPosition.controller
reactorCtrl.reactions.setName 1 "UnSquashed"
reactorCtrl.reactions.setVectorState 1 [1,1,1]
reactorCtrl.reactions.create name: "Squashed"
reactorCtrl.reactions.setVectorState 2 [1.5,1.5,.4]
reactorCtrl.reactions.setValueAsFloat 2 10
reactorCtrl.reactions.setInfluence 1 6
reactorCtrl.reactions.setInfluence 2 5.5
reactorCtrl.reactions.setStrength 2 1.5
reactorCtrl.reactions.setFalloff 1 1.75
ss = StringStream""
reactorCtrl.reactions.getType()
ct = reactorCtrl.reactions.getCount ()
format "Reactor Statistics: \n------------------------------\n \n" to:ss
format "Count : %\n" ct to:ss
format "\n" to:ss
for i =1 to ct do
(
format "Reaction #: % \n------------------------------------------------
Name : %
State: %
Value: %
Strength: %
Influence : %
Falloff: % \n\n"(i)\
(reactorCtrl.reactions.getName i)\
(getReactionState reactorCtrl i)\
(getReactionValue reactorCtrl i)\
(reactorCtrl.reactions.getStrength i)\
(reactorCtrl.reactions.getInfluence i )\
(reactorCtrl.reactions.getFalloff i )to:ss
)
print ss
|
|