SetBehaviorVariable

From MaratisWiki
(Difference between revisions)
Jump to: navigation, search
m
 
Line 1: Line 1:
setBehaviorVariable(object, behaviorId, « variableName », value)
+
{{lua-function|setBehaviorVariable|object, behaviorId, variableName, value}}
  
Is used to tweak your object behavior.
+
Set the behaviors variable.
  
#''Short description''
+
* '''object:''' The object with the active behavior
#*object : The object with the active behavior<br />
+
* '''behaviorId:''' If your behavior is the first on the list, behaviorId will be 0, the second will be 1, etc.
#*behaviorId : If your behavior is the first on the list, behaviorId will be 0, the second will be 1, etc.<br />
+
* '''variableName:''' Behavior parameter name
#*variableName : Behavior parameter name<br />
+
* '''value:''' Behavior parameter value
#*value : Behavior parameter value<br />
+
  
Small example, let's say you have a scene with two boxes (Box1, Box2), and a camera (Camera).<br />
+
'''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 :<br />
+
  
 
     setBehaviorVariable(Camera, 0, "target", "Box1")
 
     setBehaviorVariable(Camera, 0, "target", "Box1")
  
You want to tweak the behavior to make it look at Box2 :<br />
+
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 18: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")
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox