0.32 by 0.32 2D grid in Unity using Mathf.Round?
Hello,
trying to snap objects to a tiny 32 Pixels by 32 Pixels grid but i can't do it
This code rounds the position input from the mouse but i have no idea how i specifiy my grid now...
Vector 3 mPosition = Input.mousePosition;
mPosition.x = Mathf.Round(mPosition.x);
mPosition.y = Mathf.Round(mPosition.y);
Thank you in advance ^^
Comment
int xPosition = $$anonymous$$athf.RoundToInt(mPosition.x/32)*32;
will round to the closest multiple of 32
Your answer
Follow this Question
Related Questions
Move object to grid 1 Answer
My collisions dont detect in gridbased system (check if in certain area) 0 Answers
Drag and Drop Problem 0 Answers
2D Colliders don't actually touch, causing problems 0 Answers
How to drag object in GridLayoutGroup 0 Answers