- Home /
Answer by MarkFinn · Sep 30, 2012 at 03:41 PM
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;
Answer by $$anonymous$$ · Aug 13, 2014 at 03:07 AM
Vector3 snappedV3 = new Vector3(Math.Round(oldV3.x/gridSize),Math.Round(oldV3.y/gridSize),Math.Round(oldV3.z/gridSize))*gridSize;
Answer by BPocnitura · Nov 02, 2016 at 03:45 PM
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
Your answer
Follow this Question
Related Questions
Minecraft block placing/ block building - how to? 2 Answers
Distribute terrain in zones 3 Answers
This script does not work propely in my game 1 Answer
Snap blocks that aren't cubes. 1 Answer
Realistic block placing/building 1 Answer