SetBehaviorVariable
From MaratisWiki
(Difference between revisions)
Dahnielson (Talk | contribs) |
Dahnielson (Talk | contribs) m |
||
Line 1: | Line 1: | ||
− | setBehaviorVariable | + | {{lua-function|setBehaviorVariable|object, behaviorId, variableName, value}} |
− | + | Set the behaviors variable. | |
− | + | * '''object:''' The object with the active behavior | |
− | + | * '''behaviorId:''' If your behavior is the first on the list, behaviorId will be 0, the second will be 1, etc. | |
− | + | * '''variableName:''' Behavior parameter name | |
− | + | * '''value:''' Behavior parameter value | |
− | + | ||
− | + | '''Example:''' Let's say you have a scene with two boxes (Box1, Box2), and a camera (Camera). The camera have "LookAt" behavior active and is set to look at Box1, so your behavior is currently. | |
− | The camera have "LookAt" behavior active and is set to look at Box1, so your behavior is currently | + | |
setBehaviorVariable(Camera, 0, "target", "Box1") | setBehaviorVariable(Camera, 0, "target", "Box1") | ||
− | You want to tweak the behavior to make it look at Box2 | + | You want to tweak the behavior to make it look at Box2. |
setBehaviorVariable(Camera, 0, "target", "Box2") | setBehaviorVariable(Camera, 0, "target", "Box2") |
Latest revision as of 17:58, 8 February 2014
setBehaviorVariable(object, behaviorId, variableName, value)
Set the behaviors variable.
- object: The object with the active behavior
- behaviorId: If your behavior is the first on the list, behaviorId will be 0, the second will be 1, etc.
- variableName: Behavior parameter name
- value: Behavior parameter value
Example: Let's say you have a scene with two boxes (Box1, Box2), and a camera (Camera). The camera have "LookAt" behavior active and is set to look at Box1, so your behavior is currently.
setBehaviorVariable(Camera, 0, "target", "Box1")
You want to tweak the behavior to make it look at Box2.
setBehaviorVariable(Camera, 0, "target", "Box2")