Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Timelines: How do I trigger certain timelines to play and stop based upon interactions?

Discussion in '2017.1 Beta' started by Kmausser, Jun 21, 2017.

  1. Kmausser

    Kmausser

    Joined:
    Feb 17, 2016
    Posts:
    23
    I'm trying to use timeline to play an animation for an object, then when the player clicks on another object with their mouse it plays the timeline animation for that and also plays a closing animation for the first object as the camera moves away to the second object.

    To simplify:
    1. Scene starts with first camera active and objects standing still
    2. User mouses over to select an object in view and the camera whips around (I'm using cinemachine's free look cam) to get a closer view of it while the object itself bounces/spins to meet the camera and spits out animated text which is used to describe the object.
    3. User wants to click on another part/object so when they click anywhere outside of the first object it animates back to it's first position
    4. The camera whips around to the next object where it's individual intro animation plays or it can go back to the starting camera angle to see everything (depending on what's clicked)


    Forgive me if this is too basic, but I'm not very experienced in triggering animations and I was thinking the new timeline feature would be easier for me to wrap my head around than learning mechanim. I'm just not sure, can someone help me do this?
     
  2. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    56
    Hi Kmausser,

    There’s a lot of ways to achieve that with Timeline but it dependents on what you are exactly trying to do. You might have to try different approaches before finding the one that better suits your use case.

    A good way to do start is to have a PlayableDirector for each object/part you want to inspect and a MonoBehaviour that handles user interactions to appropriately call PlayableDirector.Play()/Stop() when switching from an object to the other.

    Also, there’s a lot of possibilities when mixing Timeline and Cinemachine! You’ll find more on the dedicated forum!

    Thanks!
     
    charlesb_rm likes this.