Please help me!

I need a script to place blocks(prefab) align the grid like minecraft.

Thanks!

P.S: Sorry for my bad english

Please help me!

I need a script to place blocks(prefab) align the grid like minecraft.

Thanks!

P.S: Sorry for my bad english

Assuming that your grid is 1 unit cubes, this will work.

```
Vector3 snappedV3 = new Vector3(Math.Round(oldV3.x),Math.Round(oldV3.y),Math.Round(oldV3.z));
```

if your grid is not 1 unit squared then where gridSize is a float

```
Vector3 snappedV3 = new Vector3(Math.Round(oldV3.x/gridSize),Math.Round(oldV3.y/gridSize),Math.Round(oldV3.z/gridSize))*gridSize;
```

Vector3 snappedV3 = new Vector3(Math.Round(oldV3.x/gridSize),Math.Round(oldV3.y/gridSize),Math.Round(oldV3.z/gridSize))*gridSize;

Or just make a invisible block named air and put it every where to place every block, and the use math.round with replace function

@MarkFinn Whatโs The oldV3?