Today, I was able to prototype the basic control for striking the ball around! Take a look!
You can also check out the still image below, showing the trail left by the golf ball as it moves:
The basic mechanic work, and I already planned ahead by letting the shot function be modifiable according to the type of shot. There’s still lots of improvements to be done, specially regarding the physical properties of the ball and the terrain.
But to connect it to the current terrain system, I’ll need a procedural collider that more accurately matches the terrain the ball will run through. Unity’s default mesh collider will “optimize” the collider mesh down to 255 vertices, which isn’t great. So I’ll create a script that takes the position of the ball, and generates the collider for the tiles that the ball is likely to touch. This way I’ll save on performance by not needing hundreds of colliders on at any time, and can be easily expandable to support more than one character. In theory.
In any case, it’s working, and it feels pretty nice. Will be even better when I get the display working letting you know more accurately how your shot will curve!
I predict we’ll be playing some holes this weekend!