Binding Animation Players
This tutorial goes over how to bind an animation player to another.
What is it
Binding animation players syncs state between them and has the "child" animation players update directly after the "parent". This means you can control one and it will control all animation players bound to it.
You can either have an animation player's state be controlled via :bindToAnimationPlayer()
or time be controlled :bindToAnimationPlayerTime()
.
Binding is also synced from server to clients (but not vice versa).
Signals related to binding animation players are onPreBoundUpdated
and onUpdated
.
onPreBoundUpdated
fires before bound animation players are updated and onUpdated
is fired directly after all bound animation players are updated.
There is currently no protection against circular bounds!
Please make sure you do not run into this issue. (thank you)
Uses
- Drop Tracks/Elevator Lifts
- Spinning Cars
- Flat Rides
Setup
local animPlayer1 = rideManager:getAnimationPlayer("AnimationPlayer1")
local animPlayer2 = rideManager:getAnimationPlayer("AnimationPlayer2")
animPlayer1:bindToAnimationPlayer(animPlayer2)
Binding should be thought of as setting the parent of an animation player to the given animation player. This makes the parent animation player update the child animation players after.