Grid system position has an offset in x axis

any ideas?

Your units aren’t centered, which may be the issue. It may also not, but fix that and check

in the code I have put copy paste the code monkeys code but for some reason the grid starts from position -2 instead of 0 when I have put it to start form 0

image
I meant this. This should be something like (2, 2, 0)

Check the position of LevelGrid. Make sure it’s at (0, 0, 0)

sorry my bad, my screenshot was on play mode. I have it on 0,0 when initializing.




Sure, but even when they’ve moved, their positions should still be integers. Walking from 1 grid cells to another is 2 units and 0 + 2 is not equal to 1.821536

Your play mode is full of errors, but I suspect that’s because the cell calculations has issues. Can you quickly share the MoveAction, and perhaps the GridSystem (where the errors are coming from)


Edit
LevelSystem code would help, too. So we can see why your grid is offset incorrectly

sure!! I just followed code monkey’s tutorial, I copy pasted the scripts let me share.

GridSystem Script:


MoveAction script:



Screenshot_10

LevelGrid script:


OK, Ignore my posts about the position. I see you are still very early in the course and the course has not gotten to that point yet.

I’m trying to figure out why your grid positions are showing up wrong. Can you show the unit prefab with the player model selected? Or you could just make sure that the character model is at x=0 and z=0


Basically, these bits

sure! thanks again for trying to help! I think the problem is that the grid for some reason starts from position -2 or sth but in the initialization I put it from 0. also the as you can see the selected units are one tile further on the x axis but z axis is ok.




also these I dont know if they help


Oh, there’s your problem


The text is offset by -2, so it’s not sitting where it’s supposed to be, but 2 units to the left. That should be 0

1 Like

yes, never checked the child of the debug visual, it had an offset, thank you very very much my friend!!!

Privacy & Terms