# 3-D Grid snaping i do not get plz halp

#### Gamedev3

##### New member
hey guys pleeease i need help with this one thing:
I got an equation for grid-snapping in a 3-d space, but is there any equation that allows me to gridsnap units diagonally? Like when im rotating some 3-d object i want it to gridsnap in those directions

#### Attachments

• 15 KB Views: 2

#### Dr.Peterson

##### Elite Member
Since the first step may be to understand how your existing "equation" (which I suspect is more than that) works, so you can apply it in the new situation, it will be helpful if you can show that.

Then we may need a more complete description of what you want to do. It appears that you are rotating not only the object, but the grid. Please clarify the goal a little.

Finally, as always, we like to see what you have tried, which not only helps show what you want to do, but also what skills you have and where you need help. In particular, how are you doing rotations?

#### Gamedev3

##### New member
k so for grid snapping(sorry if its poorly worded, im not good at explaing the problem),
I'm using the equation, round(Position/DimentionsOfObject)*DimentionsOfObject which works fine if the orientation is rotated at 0,0,0,
Image A 1 & 2:and the way i rotate the 3-d parts is just turning them,
Image A 2but then they just clip through the ground and stuff,
Image B so i used an equation that finds out of the 8 points/corner of the cube, then subtracts to find the new dimentions of the object Example: highest point-lowest point = Yunit,
Image C and it all works fine but, say i have a slanted surface, the equation above^ will just make it snap like a cube kind of? idk how describe it,
so i need a new equation that can measure the units of an object, also depending on the slant of the surface, or maybe just gridsnap diagonally? noooo clue

#### Attachments

• 56.3 KB Views: 1
• 65.5 KB Views: 1
• 83.7 KB Views: 2
• 218 KB Views: 2

#### Gamedev3

##### New member
welp figured it out, just had to rotate the position around the center of the object it was on, to be at the orientation 0,0,0, so everything would snap normally, and then i rotated the positiion back around the center to be at its original orientation, so there problemo fixed