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 0

reactorCtrl.reactions.setName 0 "UnSquashed"

reactorCtrl.reactions.setVectorState 0 [1,1,1]

reactorCtrl.reactions.create "squashed" 25

reactorCtrl.reactions.setVectorState 1 [2.5,2.5,.4]

reactorCtrl.reactions.setValueAsFloat 0 10

reactorCtrl.reactions.setInfluence 0 6

reactorCtrl.reactions.setInfluence 1 5.5

reactorCtrl.reactions.setStrength 1 1.5

reactorCtrl.reactions.setFalloff 0 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 = 0 to ct-1 do

(

format "Reaction #: % \n------------------------------------------------

Name   : %

State  : %

Value  : %

Strength  : %

Influence   : %

Falloff  : % \n\n" (i) (reactorCtrl.reactions.getName i)

(getReactionState reactorCtrl (i+1)) (getReactionValue reactorCtrl (i+1))

 

(reactorCtrl.reactions.getStrength i) (reactorCtrl.reactions.getInfluence i )

(reactorCtrl.reactions.getFalloff i ) to:ss

)

 

print ss

See also

Reactor Controllers