Answers for "snap to grid math"

0

snap to grid math

int gridCubeWidth = 16, gridCubeHeight = 16;

cube.Position.X = Math.round(cube.Position.X / gridCubeWidth) * gridCubeWidth;
cube.Position.Y = Math.round(cube.Position.Y / gridCubeHeight) * gridCubeHeight;
Posted by: Guest on April-23-2021

Browse Popular Code Answers by Language