More Course Corrections

The main difficulty in fixing the issues with these little gaps… is figuring out the best solution. The Unity physics engine (as many others) are all collision based engines. Swinging the golf club at ridiculous speed will make it phase through the ball because in reality the collider doesn’t actually move through all the space. It jumps, and this is going to be another issue I’m going to have to fix because there will be that one player that will complain they can’t fire the ball into the sun.

The relevance to my current task, of course, is that each of my tiles consists of polygon planes and not actual cubes. I did this for a couple of reasons, primary of which is the sphere collider of the ball would hit the ‘corner’ of the cubes and would sometimes bounce upwards when it rolled between them. So, I went with planes to reduce the possibility of bounce as long as the planes met up with each other exactly.

Enter the .0000001 problem.

All of my tiles had to be resized. I bought them as an asset from the unity store, mostly because I didn’t understand Blender quite enough to make them myself. They were gargantuan (for some reason) but I found that reducing the scale down to .125 just worked in terms of size relevant to the player. I also created a single tile, a T-Intersection, using the others as a blueprint.

As I go through my created courses, I’m seeing various tiles having their scales altered. Instead of .125 they show up as .1250001 on their scale. There’s no detectable pattern for this, so it’s not a scenario where I could globally select all curve tiles and fix the scale.

But these tiles are all 1.6 meters in size (in game). Or they -should- be. So I should be able to turn all tiles to .125 and make sure that they’re exactly 1.6 increments (or 0.8 increments, for the half-tiles) apart, and no gaps.

The infuriating thing is the tiles that are showing up with the extra .0000001 are not always the ones that also show gaps. I’m seeing roughly two gaps per course with different sections, and I’ve noticed that the gaps are usually on the Z axis (with a smattering on the Y axis but these have, thus far, always fixed when I fix an odd Y value with either .325 or .7 values).

There are two ways I can solve the gap issue, and I’ve been experimenting with the ‘right’ way.

First, I can adjust positioning so instead of them being 1.6m apart, I can change it to 1.5999, 1.5998, and so on, to compensate for each subsequent gap encountered. My concern on this is that it moves -all- tiles further down the line, and I’m not 100% sure that it won’t somehow cause alignment issues with other tiles later on in the form of new gaps.

Second, I can adjust the Z scale just a little. Instead of .125 I see that .1251 extends the tile -just enough- to eliminate the gap. But this also potentially creates some overlap, and if there’s two edges overlapping, I’ve seen the ball jump on these as well.

Each adjustment, each change, requires testing. Racking up swings of the club to see if the ball jumps (or somehow, phases downwards) because the game needs to be perfect and bug-free. And I need to test it immediately because I can’t just hope I’ll remember the gap between tile 2 and 3 of course 14 had a gap, as well as 4-5-6.

So since my last posting, I’ve been working, a lot, on my first 18 holes. I -think- I’ve worked it down to a pattern now, but it’s still slow going. There’s no magic bullet to make it run faster, I’m afraid. It’s just number crunching.

I picked the above picture because as I’m running through all these iterations, I’m -hoping- I am using the right solution. There’s no real documentation on the correct way to do this, so I’m in unexpected waters.

I hope everyone is having a great day. Off to crunch more numbers!