With Conditional Logic, you can trigger actions based on conditions: distance, value comparisons, or state changes. That way, creating more immersive experiences that react to the object’s input is possible, like a door opening when a character approaches using Game Controls.
Adding a Conditional Logic Event
Here’s how to add a Conditional Logic event to your scene:
- Select the object to that you want to add a conditional event.
- Add a new event on the Events Panel and select
Conditional Logic
. - Open the Conditional Logic event to start adding and tweaking actions and parameters.
Understanding Conditional Logic Events
Conditional Logic events are based on the “If → Then / Else” expressions to trigger actions based on the conditions mentioned earlier.
Conditions: if
The conditions refer to the statements that are defined and execute actions if the statements are met. The conditions available in Conditional Logic events are the following:
- Distance: Measure the distance between objects in units. If the distance is met, the action will trigger.
- State Change: Detect if an object changes to a specific state to trigger an action in the same or another object.
When the condition is true: then
If the condition is met an action is triggered. In Conditional Logic events, actions are based on transitions and sound.
Transitions can target objects and trigger a state change with transitions, delay, cycle, and loop properties. Sound actions can play, pause, and stop sounds from Spline’s Original Sounds Library or your own custom sounds.
A Super or Super Team subscription is needed to access Spline’s Original Sounds Library.
When the condition is false: else
If the condition isn’t met, another action can be triggered. Same as with then
, else
actions are based on transitions and sound.
Adding a Distance Condition
Select Distance under If
to add the condition, then, select the objects to measure the distance of and finally type the distance value.
If the distance is reached from object A to B, the then
action will be triggered. An else
action can be added if the condition isn’t met.
Adding a State Change Condition
Select State Change under If
to add the condition, then, select the object to detect the state change from, and finally select what state to detect.
If the State Change is detected from the selected object, the then
action will be triggered. An else
action can be added if the condition isn’t met.
Preview the conditional logic event
You can preview the logic of the Conditional event at the top of the event panel. This can help to better understand the logic and the actions that will be triggered under the selected condition.
Try the experience 👇
You can mix Conditional Logic events with Game Controls and Physics to create immersive experiences. Try it out below!
Use W S A D
keys to move the character, SPACE
to jump, and ↑↓←→
keys to move the camera.