# Placing Poblem (in-game)

Good Evening from Austria,

I’m currently working on a In-Game Map Editor, but i got a Problem with Placing the Objects.

My problem is, my Mouse Object (the Object Attached to the Mouse, moves with the Mouse) snaps not exactly at the other object, mostly there is a short distance between.

Here My Level Blueprint:

Now, is there a way to snap it in-game?
I also thougt about a Grid System, that the Object is only Moving inside a Grid, now the Block is 270 units long, wide and heigh. I also adjusted the Other Objects to this Value. But how can i make a Grid System with this Value?
I don’t need to draw a Grid, i just want to use one.

To show what i mean,

Greetings
Cybergebi

i think you would need to show a ghost cube for near by grid slot, so if play decide to place a cube, it snaps to the one indicated. this will also help your problem since you are drawing a ghost cube to closest grid from your physical cube, thus no on the fly snapping problem where player might loose control.

Thanks,
But how can i calculate the Nearby Grid Slots?

The easiest way to get grid point is to use rounding, ie assume only on x axis, gridx = x/270 so now gridx increase/decrease 1 for every 270 unit.
Then abs(gridx-floor(gridx)) > 0.5, true then x = ceil( gridx )*270, false then x = floor(gridx )*270. Do the same for all 3 axis.

It works perfectly _

Thanks You, it’s awesome

I dont get it, may you share the bp? im interested on this.

Thanks.

I’m currently working on a system that will snap in all 3 axis. This is what I currently have, it very similar to what was described above.

Here you go.

The Object does only Snap to the map surface or to other Objects to Stack them

Level Blueprint

Calculation

Set Ghost Cube, the Cube always go with the Cursor on the Map

Spawn Object

You can ask if you doesnt understand something

Greetings
Cybergebi