Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411413 Posts in 69360 Topics- by 58415 Members - Latest Member: sophi_26

April 16, 2024, 03:57:17 AM

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


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
Eigen
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.
Logged

missionctrl
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.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic