Examples¶
Spinning Cube¶
Let’s make a simple spinning cube!
- Drag “Rotate(xAngle,yAngle,zAngle)” from the palette’s UnityEngine Transform folder onto the canvas
- Drag your cube game object from the scene hierarchy onto the “Transform” variable
- Alt+drag the x,y,z angle variables to bind them to desired values (a convenient shortcut that works for all numeric variables)
The spinning cube brain now looks like this:
Flying Cube¶
Let’s make the cube fly forward.
- Drag “Translate(translation)” from the palette’s UnityEngine Transform folder onto the canvas
- Drag the cube from the scene hierarchy onto the “Transform” variable
- Drag “forward” from the palette’s UnityEngine Vector3 folder onto the “translation” variable
The flying cube brain looks like this:
Exploding Missile¶
Let’s try a more advanced example, like a missile that spawns a particle effect explosion and increases the player’s score.
- Create an “Explosion” particle system, style it to your liking, and make it a prefab
- Create a “Missile” object, make it’s collider a trigger, add a rigidbody and a brain
- In the brain, make the missile travel forwards
- When it hits an object, instantiate the explosion prefab and make that clone self-destruct in 3 seconds
- Also increase a “Score” stored in PlayerPrefs
The result should look something like this: