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:
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!
If you’ve played the latest demo, you may have found that the ball moves quite unrealistically; that is, it’ll suddenly move a lot further after bouncing than it should, and something must surely be wrong!
Well, you are right!
When it comes to Unity, it has a standard definition of 1 grid unit = 1 meter. Which is great. However, for the sake of optimization (or prototyping), currently Boss Golf works with 1 grid unit = around 25 meters in real life (that is the approximate size of each tile!). So Unity’s physics systems won’t really like that so much, as it isn’t made with different scales in mind.
Therefore, at some point, it may be likely I’ll have to roll out my own physics implementation, that makes sense with the gameplay; or re-scale everything to match Unity’s 1 unit = 1 meter scale, which I really don’t want to do because the current terrain system works extremely well.
For now, however, I have tweaked the physics settings, plus the drag on the ball/terrain, and added a small tweak to dampen the angular velocity further, ensuring that the ball comes to a stop.
This little tweak will be used later to react to different kinds of terrain too, so it’s a two-for-one kind of deal.
I’ve updated the current demo with the new changes, and you can find it, and download information, HERE!
That’s all for today’s quirk! Have fun!