Snap object to the local grid.
Hello! Please tell me how to attach the object to the grid on the object? I know how to snap to grid, but only with the global coordinates. I can not figure out how to snap to the local coordinates of the object. Given that the object rotates. In short, you need something like this:
Sorry for my English. I do not know him and have used Google.
Answer by hexagonius · Feb 08, 2016 at 09:39 PM
I assume the cube has it's pivot in its center and is pretty much oriented facing us with transform.Back. calculate x and y for the grid and put them into a vector 3. z of that vector is 1/2 transform.Back them. using transform.TrasformPoint(thatVector3) will put the calculated point into world coordinates.
Your answer
Follow this Question
Related Questions
Enemy AI for Multiplayer (using NavMeshAgent) unity 5.6.5f1 0 Answers
uNet FPS Camera Error [C#] [Unity 5] 2 Answers
How to instantiate weapon shots based off Weapons class abstract implementation? 0 Answers
Creating a pause screen and resuming gameplay? 2 Answers
Sharing Variables Between Projects 3 Answers