Place an object on a grid with rotation

Hi

I would like to place my tile (2x2) on my grid made up of 1x1 tiles.

If my board has no rotation, it works fine :

but if the board has rotation, the position of the tile is not correct :

Any idea to fix this?

My blueprint :

1 Like

If you draw a debug cube for the mesh bounds, you’ll find that they go all over the place when you rotate the object. So I’d recommend not using bounds to make your calculation.

Rather go for just actually knowing the width of the object.

Even dimensions are good, right?
If not, what method should you use?
Thanks in advance

I think we need to add other values in x and y, but what? to take into account the rotation

Ignoring the size for now, just taking the location of the component, and the rotation of the actor does the trick

grid

Yes, it’s ok with a 1x1 tile.

But I use a 2x2 tile, and it is positioned in the middle (its normal).
So that’s why I add half of my bounding box to shift it.
But it doesn’t work correctly with a rotating board.

Like I say, you will never get there with bounding box…

boundingbox

You can add half the size of a grid section to the forward ( or side ) vector.

always the same problem with the rotating board…

My blueprint is good?
(I set a hard 50 for my tests which corresponds to half)

This puts the blue cube at an intersection

But the problem is knowing which way to move the vectors

grid

Ah yes, it works.
Thank you very much for your help

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.