Search Unity

Solve animation movement problem

Discussion in 'Animation' started by Darjamfar, Mar 17, 2014.

  1. Darjamfar

    Darjamfar

    Joined:
    Jun 4, 2012
    Posts:
    63
    I am making a simple soccer game. I have a goalkeeper who can dive to save shots.Let's say we have a penalty. My goalie fires two lines to left and right using transform.right and transform.right * -1. I have a line intersection algorithm takes ball movement and calculates where on either of those two lines the ball intersects. That's working, i know where on the line the ball will hit.

    So if the intersection point of the ball is 3m away i can move the goalie 3m over a second using Time.deltaTime * 3 but here's the problem, if it's a hard shot the ball is already in the back of the net by the time the goalie arrives at the intersection point. If it's a soft shot he dives gets up and collects the ball.The dive animation takes 0.9seconds. If i divide the distance to intersection point by ball.velocity.magnitude I get a figure like 0.3, or 0.44 - not sure what this is telling me. I'm sure if i knew calculus it would be a breeze. I'm using legacy animation.

    Anyone know how might i solve this ?

    Thanks
    DJ
     
  2. apollo25

    apollo25

    Joined:
    Apr 28, 2014
    Posts:
    5
    I am too young so It would take 2yrs from now for me to learn calculus.
    All the that I can give is that an advice to use mecanim animation system.
    If your game is 3d can u please give me the dive and kick anims at my email id - unity3d.pranav@gmail.com
    Thanking u in anticipation.