Search Unity

Set character position and root motion problem using timeline

Discussion in 'Timeline' started by samoliver1813, Nov 2, 2017.

  1. samoliver1813

    samoliver1813

    Joined:
    Sep 20, 2015
    Posts:
    3
    I am implementing an interaction system using the timeline and am having some problems



    code
    Code (CSharp):
    1. void EnterAnim(){
    2.             player.transform.parent =  playerPivot;
    3.             //player.transform.localPosition = Vector3.zero;
    4.             //player.transform.localRotation = Quaternion.identity;
    5.             TrackAsset track = (TrackAsset) ta.GetOutputTrack(0);
    6.             AnimationTrack at = track as AnimationTrack;
    7.  
    8.             if (at != null) {
    9.                 at.applyOffsets = true;
    10.                 Debug.Log (at.name);
    11.                 player.transform.localPosition = at.openClipOffsetPosition;
    12.                 Debug.Log (at.openClipOffsetPosition);
    13.                 player.transform.localRotation = at.openClipOffsetRotation;
    14.             }
    15.  
    16.             pd.SetGenericBinding (track, player.gameObject);
    17.             pd.Play ();
    18.         }