Search Unity

How to animate soccer player?

Discussion in 'Animation' started by unity2, Nov 22, 2017.

  1. unity2

    unity2

    Joined:
    Jan 10, 2013
    Posts:
    23
    Hi,

    I am currently trying to make a soccer type game. I am trying to find out how players will interact with ball. For example if any player give a pass to another player then how other player receive ball with proper animations. I know basics of Mecanim and IK concepts but need some guidance into this.

    I know I need to make animations in some 3rd party software like blender etc and have to import in Unity and using Mecanim, create states and different transitions. But how the player rotate his upper half body and legs according to the ball position so that it looks like player properly reacts according to ball position.

    Any tutorial or suggestion would be of great help.

    Thanks!
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    I don't know the answer to this question, but I'll take a guess at it.

    The characters will need a bit of AI (programming) to know when the ball is close to him. The AI will drive the characters not controlled by the player either towards the goal or towards the ball, or a combination of the two. You will have to decide how this is best set up for your game. Default run, jog, defend etc animations will play during this time.

    Each character will have a couple of trigger volumes, for simplicity lets say 2 total, an inner trigger that is set close to the players maximum extense, as far as he can reach with his feet, and an outer trigger that is maybe 3-5 meters around the player.

    The outer trigger volume can be considered the characters 'notice'. When the ball gets within the outer trigger the character will be aware of the ball being close to him. This will make the character maybe more aggressive to turn towards the ball or cut off a passing lane as a defender. The character will naturally be angled to either receive a pass or block a pass of the ball if the AI you create (mentioned above) works correctly.

    The inner trigger volume can be considered the characters 'alert'. When the ball gets within the inner trigger the character will attempt to control the ball. The animations at this point will need to be interrupt-able or blended to allow the default run cycle to blend into the dribbling, blocking or one of the numerous kicking animations you will have.
    If the animation cycles are set up correctly this will look good and there will be minimal to no foot sliding - which will break the immersion.
    Consider prototyping/testing this set up initially with one run, one dribble, and one kick cycle. This will help you work out the concept without making a ton of animations, AI and triggers.

    The difficulty here IMO is how to control the ball instead of how to animate the characters. The ball can either be controlled by physics, animations, or a combination of the two which is probably the correct answer, but this will need to be prototyped and tested.
     
  3. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    I don't know either.

    I know dribbling and controlling the ball by physics is virtually impossible, so I would go about it similarly:
    - trying to choose suitable animation for receive, dribbling (based on ball's position/height) and
    - lerp the physical ball's position into animated ball's position (maybe with checking if the foot/chest/head(?) is close enough when this happens)

    basically switching between physical ball and animated ball
     
    theANMATOR2b likes this.
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Yeah - agree - however I think there is a game hidden in that impossible-ness. Maybe not a 'realistic' soccer game, but one that increases in enjoyment when increasing in difficulty/frustration. ;)