Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make my building system snap on part surfaces and on a grid, like the classic Stamper Tool?

Asked by
Y_VRN 246 Moderation Voter
4 years ago

|If possible please write easy answers for me to understand when it comes to CFrame math! I'm still figuring out how it works. Thanks in advance.|

My goal here is to make a building system where I could snap objects to surfaces of other objects while still following a grid (like the Stamper Tool or something else similar.)

Currently I've only managed to make grid snapping (I deleted that part of the code.) Surface snap only works when I remove the grid snapping functionality and all the workarounds I could think of don't work correctly (or I'm probably just tired when I work with them).

What else can I do to make this happen?:

01local PlayerCont = game:GetService("Players")
02local Mouse = PlayerCont.LocalPlayer:GetMouse()
03local PlacementCursor = Instance.new("Part", workspace) -- Since FilteringEnabled is true, we can
04-- make the player's cursor invisible to others.
05local SnapByStuds = 4
06 
07local States = { -- Non functional
08    OFF = 0,
09    BUILD = 1,
10    EDIT = 2,
11    COLOR = 3,
12    WIRE = 4,
13    CLIPBOARD = 5,
14    REMOVE = 6
15}
View all 96 lines...

Thanks (again) in advance!

Answer this question