top of page
Search
Writer's pictureAbish Neel

Week 1: Semi-custom Ball Physics and Dribbling

Updated: Jun 9, 2023



The first week of this project involved setting the project in Unreal Engine 5.1 and connecting to source control.

The other goal of this week was to write a layer of abstraction on top of Unreal's physics system to give the player more control over ball movement for dribbling, passing and shooting. This involved writing a ball physics component that can take in a desired target position and suggest the velocity required to move the ball to that spot within a single frame.

Although this system requires more fine tuning, this allowed to have a first pass at the dribbling (soccer) mechanic.


Path prediction function which suggests a velocity to apply to a body to get it to move to a given spot over 1 frame using the physics equation s = ut + 1/2 at^2.


In order to make the dribbling mechanic to look and feel better I had to set up animation triggers within the idle, walk and run animations of the UE5 default character. Since the default animation blueprint uses blend states to seamlessly blend between locomotion animations, the animation trigger played on the most weighted animation is played when it gets it. This allowed me to call the Dribble function on the player through blueprints which in turn calls the GetSuggestedBallVelocity() function and pushes the ball with that force. The "DesiredSpot" parameter passed in is the the player's forward vector multiplied by the player's velocity. This results in a semi-realistic look and feel of dribbling where the player has the ball under control.


A video showing off the player dribbling the ball using physics.


A challenge I came across this week was that the ball physics looks close to accurate but not fully accurate. I wish to address this in the coming weeks by employing more complex physics equations to calculate the ball paths during dribbling. This is system however is good enough to implement passing and shooting as of right now.


The upcoming week is going to involve getting the ball physics to a point where the player has more control over it and making dribbling states in order to support tackling, which will be implemented at a later time. In addition to this I also aim to do a first pass at the passing mechanic using the ball path prediction.



16 views0 comments

Recent Posts

See All

Comments


bottom of page