Snowball Event

Snowball Event

Starting Trigger State and Update State

Starting Trigger State and Update State

On start, turns on physics to set snowball then sets it back to kinematic. Waits for player trigger to start event to save performance.

On start, turns on physics to set snowball then sets it back to kinematic. Waits for player trigger to start event to save performance.

Whole view of tracking state

Whole view of tracking state

On start grab starting position to use for Z  transform freeze

On start grab starting position to use for Z transform freeze

Set snowball trail position based off position of snowball so that it's always on bottom of snowball no matter the size and then lock Z position. 

Lastly check velocity tolerance

Set snowball trail position based off position of snowball so that it's always on bottom of snowball no matter the size and then lock Z position.

Lastly check velocity tolerance

Check if max scale is reached and if not then add to scale but if so then move on. Animator triggers for player to push and stop pushing snowball

Check if max scale is reached and if not then add to scale but if so then move on. Animator triggers for player to push and stop pushing snowball

Set size multiplier of particle emission and radius so that it scales properly with snowball scale

Set size multiplier of particle emission and radius so that it scales properly with snowball scale

Check if grounded if and not then stop particle system. Scale raycast ground checker to scale of snowball.

Check if grounded if and not then stop particle system. Scale raycast ground checker to scale of snowball.

Trigger system to detect if snowball is melting due to flame object

Trigger system to detect if snowball is melting due to flame object

Snowball Event

This script was a fun one to play with. It was made using Bolt's visual scripting tool for Unity.

Snowball behavior as follows
-On start, turns on physics to set snowball on ground then turns it back to kinematic
-Snowball scales up by taking scale and adding to itself if the velocity is greater than tolerance
-Scale checks to stop if desired max scale is reached
-Mass and Drag scale appropriately based off scale
-Particle trail plays only when velocity tolerance is greater or equal to and pauses when not
-Ground detection raycast to detect when to pause particle system if snowball is no longer touching ground.
-Ground detection raycast scales length based on scale of snowball
-Snowball also shrinks if object with tag enters trigger to "melt"