Offset

What could be causing this? They seem to have an offset of 1 tile and also don’t update up the z-axis.

image

Sounds like perhaps you’re doing the math wrong when converting world position to grid position.
Add some Debug.Log when calculating the Units grid position, do a log on the transform.position and the resulting gridPosition. Then go inside the Grid System and look at how you’re calculating it.

1 Like

I spent like 3 or 4 hours going through the code and in the end it was as simple as the text child of the GridDebugObject was initialized at (2, .02, 0), so it had an offset by an entire tile. As for the update on the z-axis, it indeed had a miscalculation in the GetGridPosition method, I was rounding x and y instead of x and z.

Hopefully, this is helpful to anyone with a similar problem, and thanks Hugo for the advice.

6 Likes

Thank you! I had the offset of 2 on the x axis of the label as well.

had the same issue, you just saved me a lot of time. TY

I just had the same issue, and the same solution worked for me. Thanks!

Dude you are awesome!! I was panicking till your comment fixed my problem

Same!

Privacy & Terms