How do I implement the first touch system just like in Fifa or Pes
Without any code it is hard to guess, but I would use this approach:
Perfect trap:
- Extend the collider that you use to detect that the player is receiving the ball (just slightly, so that you have a few pixels of space between players legs and the edge of the collider).
- When the ball collides with the collider, use Vector3.Lerp function to "smooth" the transition between the points in which the ball is moving and when it stops.
- You can put that Lerp function in an if() block, and use conditions like player stats, speed of the ball etc. to determine if the first touch will succeed or if the ball will bounce away from the player.
Imperfect trap:
- If you want it a bit more realistic, you could use two Lerp functions - one to regulate the transition from the edge of the collider to players feet (time right before the trap), and the other from his feet outside (time after the player tries to trap the ball). Depending on players skills, the second Lerp can regulate the speed, distance and direction in which the ball would go after the player tries to stop it (naturally, if the players stats are higher, the ball will fly a smaller distance, and stop closer to the player than if the stats are higher)
This is just an idea, hope it helps.