Using the entityVelocity channel
If the Locomotion Behavior is not reacting as you want, or if you need more control, you can use a the entityVelocity Channel to control a network of Motion Behaviors.
Let's see how we can start a behavior only if the velocity magnitude is greater than 0.5:
- Double-Click on the Start Trigger in the Behavior Editor
- Add an Expression Trigger
- Right-click on it, as choose "set as root"
-
In the attribute editor
- Enter this.entityVelocity in the expression field
- Set the wanted operator
- Enter the value to which you want to compare the speed of your character (beware of units)
Note: because at simulation init values can be strange, it may sometimes help to protect the trigger with a Frame Trigger, so that the entityVelocity trigger is only activated once the simulation values are stabilized
You can use this with multiple motions in parrallel with different start/stop conditions, in order to play the walk, run, idle motion based on the particle speed.