- Home /
Question by
Thomas 1 · Jun 22, 2011 at 02:09 AM ·
gridsnaporthogonal camera
Orthogonal View: snapping objects to grid at runtime
Hi Guys!
I'm looking for suggestions of how to create a grid, snap instantiated objects to that grid during runtime.
I'm using orthogonal camera.
Ideas are welcome! Best! Thomas
Comment
Answer by _Petroz · Jun 22, 2011 at 02:37 AM
Maybe something like this:
float snap_resolution;
float x_snapped = x + (snap_resolution * 0.5f);
x_snapped -= (x_snapped % snap_resolution);
float z_snapped = z + (snap_resolution * 0.5f);
z_snapped -= (z_snapped % snap_resolution);
Your answer
![](https://koobas.hobune.stream/wayback/20220612114203im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Snap object to grid 1 Answer
Check if object is on grid 1 Answer
How to drag gameobject (only x y) snapped to a grid? 2 Answers
Gizmo won't stop snapping to grid. 1 Answer
Round position 1 Answer