Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Advanced search

1340547 Posts in 61233 Topics- by 52735 Members - Latest Member: AarslandM

June 17, 2018, 03:41:33 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Ball in Soccer Game
Pages: [1]
Author Topic: Ball in Soccer Game  (Read 446 times)

View Profile
« on: May 29, 2017, 02:24:45 AM »

Hey guys Smiley

We are working on a soccer game made in Unity. However I am unsure how to approach Ball movement.
I want the game to be deterministic therefore i wont be using physic based logic.

My question is : How would you approach Ball movement (e.g.  passing ball from player to player, .. ) in a most versatile, efficient approach.

I thought about few ways how this can be done:

1: To existing player animations (run, pass, free kick,...) add another empty transform and animate it.  
   Then attach ball to this platform for  player who currently has ball.

However This can bring up quite few issues (for example, if we try to change animation sets, we need to add and animate empty transform all over again ).

2. Control the ball by script - this comes with cost of having it not look as smooth as in animation approach.

If you could share your ideas or experience from handling such issue that would be great Wink

Thanks a lot Smiley

« Last Edit: May 29, 2017, 02:32:33 AM by Riso » Logged
Level 10

Brobdingnagian ding dong

View Profile WWW
« Reply #1 on: May 29, 2017, 05:27:47 AM »

Is it 2D or 3D? I would approach it by working out the simulation first. The players are vectors and ball is just a position. Work out the math to move the ball between players, and only then render it (by positioning the ball entity according to your simulation). I think trying have the ball as physics object or whatever is not going to work properly. I mean it will work, but is not the best way to go.

Level 0

View Profile
« Reply #2 on: June 02, 2017, 07:30:05 AM »

You're trying to avoid "physic based logic" but you don't really need to.  As the last post mentioned, the "physics" would consist of nothing but basic vector math operations and it will be 100% deterministic.

However, this is only for passing and shooting.  Are you looking for a solution for dribbling?  If so, then animations might be the best approach.  Use the basic vector math for when the ball is moving by itself.  And then when a player gets control of the ball, lock it to that player's position and use animations for the dribbling.
Pages: [1]
Jump to:  

Theme orange-lt created by panic