Monday, December 12, 2022
HomeGame Developmentunity - Animation leap to 0 place whereas utilizing AnimationCurve C#

unity – Animation leap to 0 place whereas utilizing AnimationCurve C#


I’m presently finding out animation creation on runtime. Right here is my code snippet the place i’m transferring my dice x place to 2.

  anim = GetComponent<Animation>();
    AnimationCurve translateX= null;
  
         translateX = AnimationCurve.Linear(0f, this.rework.place.x, 2f, 2f);
    animationClip = new AnimationClip();
    animationClip.legacy = true;
    animationClip.SetCurve("", typeof(Remodel), "localPosition.x", translateX);
    anim.AddClip(animationClip, this.identify);
    anim.Play(this.identify);

However the issue is each time i play my scene, my object place is leap to zero place.
Why it’s occurring?Like i’m solely animation x place then, y different axis are altering?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments