Search Unity

Animate from an arbitrary position

Discussion in 'Animation' started by Notsu, May 7, 2015.

  1. Notsu

    Notsu

    Joined:
    May 5, 2015
    Posts:
    7
    Hi,

    We are developping a card game , and a recurent need is to get a card gameObject from anywhere in the game space and then animate it to a fixed position ( center of the game space for example )

    We really want to do this with an AnimationClip + AnimatorController and have a big focus on performances. It means that the less object instantiations we make, the better it is.

    What would be the best solution to do this ?
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,446
    I'd probably try some of those tweening library plugins..
     
  3. ShawnFeatherly

    ShawnFeatherly

    Joined:
    Feb 22, 2013
    Posts:
    57
    This isn't possible using the Unity3D animator, because the animator requires both "To"'s and "From"'s to be concrete.

    iTween is a popular tweening library https://www.assetstore.unity3d.com/en/?gclid=CPHlwc_N0cUCFRSPfgodJj0AeQ#!/content/84

    Personally, I prefer LeanTween as it has better support for uGUI https://www.assetstore.unity3d.com/en/#!/content/3595

    If you'd like to do it yourself you can use Lerp as described here http://answers.unity3d.com/questions/44194/animate-an-object-to-a-new-position.html