Dev Update #32: Rolling Physics Fix

Dev Update #32: Rolling Physics Fix

Hello folks!

Today is a quick but important update!

After wrestling with Unity’s physics system for a while, I was finally able to land on the settings I wanted for the ball physics.

The current system works like this:

-If the ball is in the air, apply a constant drag of 0.3 to simulate air resistance. This will guarantee that the ball has a nice arc when travelling.

-If the ball is touching the land, starting a 0.3, increase the drag by a factor dependent on the tile type. (IE: increase drag faster if on sand/grass, increase drag slower if on fairway/green)

The results are roughly as seen below:

phystest

In the image you can see the end position of the ball on the 4 different terrain types. The aiming of the arc was around the 5th tile from the tee. So on the fairway, it rolled about 2 tiles more, whereas in the bunker it rolled a lot less. The values still need to be adjusted, but the important point is that the new system works!

Next will be bounce! This will also come in handy if we add different types of fairway/etc. Harder surfaces = more bounce, softer surfaces = less bounce! This will be done tomorrow!

So here’s a couple of gifs should the ball rolling differently! Enjoy!

fairway_shot

rough_shot

bunker_shot

grasshit

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s