Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Smooth animation

Discussion in 'Editor & General Support' started by xxPillsxx, Nov 19, 2012.

  1. xxPillsxx

    xxPillsxx

    Joined:
    Oct 10, 2012
    Posts:
    31
    So I'm creating a FPS game,and everything is good but the only thing that annoys me is the animation.
    When an animation plays,the gun transform from current position to the animation's position WITHOUT TIME,meaning the gun "flashes" to the animation's position and play the animation,and when the animation stop it "flashes" back,also happens when I switch from an animation to another animation,I don't like the flashy gun,I want it to smoothly move from current position to animation and opposite,I tried
    Code (csharp):
    1. transform.localPosition = Vector3.Lerp(DefaultPos,NewPos,MoveSpeed * Time.deltaTime);
    but it doesn't work for animation.So can anyone help me how to make the gun move from current position to the animation's position and start playing instead of change position to it in a flash?It's like gun sway.Thanks