Overview
The precise logic for the interactions with the ball is too big to go over here but here is an overview of the flow:
- Drop - Detach from Actor -> Enable Physics
- Grab - Disable Physics -> Attach Ball to Player
- On Interact - Box Trace for Player -> hit == true ? Pass : Throw
- Throw - On Interact -> Drop -> ( Actor Forward * Hold Duration ) -> Set Velocity
- Pass - On Interact -> Box Trace for Player -> Suggest Velocity Moving Target -> Set Velocity
Throw vs Pass
- Throwing and Passing should be handled by the same input.
- Passing should be easy to perform and not rely on skill.
- Throwing should feel dynamic and skilful.
Since I don't want the player to feel a loss of control when throwing vs. passing. I decided that a Pass should be performed on pressed, and a Throw on hold.
In actuality the action is always done on release, but if the Elapsed Time is greater than a threshold of .15s the ball is thrown otherwise it is passed.
Dolly Zoom
To enhance the feeling of the throwing mechanic, I created a dolly zoom effect for the build up during the hold duration for a throw.