Jump to content
  • Advertisement
Sign in to follow this  
Andrew Blem

How do I implement the first touch system just like in Fifa or Pes

This topic is 986 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have been working on a soccer game for the past several months. I have managed to set up a decent A. I. I am now tweaking the A. I so that it looks better and realistic. One of the area I would want to tweak is what happens when the player receives the ball. Currently the ball stops dead at the player's feet. I would want it to be like the player takes note of how much speed the ball is travelling with and the player decides on how much force he should use so that the ball stops in front of him. I know depending on the player's ball control states I can use it to decide a certain range of power the player can use (players with less accuracy have a greater range increasing there chances of making errors). I haven't tried it yet so any ideas on how to do this will be greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!