Roblox grid placement system for attachments

  1. What do you want to achieve?
    I want a building system inside of my game exactly how roblox has it’s building system when it comes to placing down attachments.

  2. What is the issue?
    I don’t know how to make it

  3. What solutions have you tried so far?
    I’ve tried youtube, this devforum, etc. Can’t find one.

Additional info to replicate behavior:
The roblox grid system is 0.125 studs; It places the attachments at 0.125 stud intervals. For example: These four attachments have the positions: -14.125, 0, 0 / -14, 0, 0 / -13.875, 0, 0 and -13.75, 0, 0.
image

They’re also half way inside whatever part they’re placed on:
image

I did this in about 10 seconds, just a super easy grid/placement system.


Thanks!

grid system is easy:
Suppose you have a random position 0.142, 0, 2.107

you want the interval to be whatever studs, so you will round them like this:
for x:
first divide by interval you will get 0.142/0.125 = 1.136
round it up it will become 1
now multiply it back by interval, 1*0.125 = 0.125

for z:
first divide by interval you will get 2.107/0.125 = 16.856
round it up it will become 17
now multiply it back by interval, 17*0.125 = 2.125

there you go, you have the grid system

Sure, that could work, and that’s what I’ve tried doing. However, my attachment can appear inside of another part.

Say we have a 2x2x2 cube at 0,1,0. The back face of the cube is at ~,~, -1. Now, lets take that through your formula.
-1/0.125 = -8
-8 * 0.125 = -1

So now my… wait that theoretically works!? Hold on, let me try that! Give me an hour though, I’m in school rn :joy:

IT WORKS!!!



THANK YOU SOO MUCH!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.