- Home /
Syncing a Seperate Object's Position and Animation with a Playable Character
I have Playable Character and a chair. When the user clicks on the chair I want the character to pull out the chair, sit down, and scoot forward.
I had the idea of creating a chair-pulling out-sit-scoot character animation and one for the chair. My question, will both animations (for the player and chair) run somewhat in sync if fired simultaneously? Or is there another way of dynamically parenting the chair to the player just for the sake of the sitting animation? Or am I going about this completely wrong?
Answer by Jason_DB · Feb 26, 2010 at 07:53 PM
Well the animations should run in sync if they begin at the same time, but you would also need to make sure that both the player and the chair were positioned correctly. Hypothetically, you could also use the animation editor to call a function which makes the chair a child of one of the character's joints (likely the wrist or whichever part is pulling the chair), and then calls another function to un-child once it has been moved (when you don't want it to move with the character anymore).
Since you can call things from within the unity animation editor you could call a parenting function like this:
chairObject.parent = playerObject;
In case you haven't really used the animation editor (I'm not very experienced with it myself) http://unity3d.com/support/documentation/Components/animeditor-AnimationEvents.html