Alright so I’m working on a building game and it needs a placement system almost identical to studio’s.
However I’m running into a few problems that are making it very difficult to get it working:
The first issue is pushing the part that is being placed out of other parts (if I just set the part being placed to the mouse hit position it will sink in). I really have no clue how to do that.
The second issue is the grid system (these parts will be placed on a grid). However the grid needs to be offset by some amount based on their building area (some vector that offsets the grid) (also just adding the offset to the position AFTER it has been adjusted to the grid is not what I want).
Alright so I should have explained slightly more.
What I meant by sink in was this https://gyazo.com/c44e77931d8612cc2c268a4fa2923b8e (this is if I just set my part position to my mouse hit position).
What I meant by push out was to push the part that’s sinking in to the slightly transparent part.
What I meant by grid offset was to offset the grid by some vector. In this case it needs to be -1, 0, 0. What should happen is that the part is offsetted by the yellow part to line up with the edge. https://gyazo.com/baa496985ceade7d9ae50ae85fcec0b1
Not sure what you mean by offset the grid as the grid would cover infinity given you know the grid step size and origin (or any other single point). If you want the part to be “pushed out” then perhaps you could explain or define when and how it should happen.
If you are trying to offset it, couldnt you just add forumulaForMouseInputToGrid * CFrame.new(-1,0,0) ?
If it varys by part size, just do the quick math for it. Assuming that block is a 4x4x4 and you need to offset it by -1, that means that to find the offset for each part, divide its X size by 4 and put that in place of the -1 in the CFrame above.
Also for grid offset what I mean is this:
What I thought would work but actually doesn’t is this:
Let’s say I have a function that can put any number x onto any number on some grid.
The grid is 4 with no offset.
So if I put in 5 it will give me 4.
However say I want 5 to go to 6 and 1 to go to 2 instead of 5 going to 4 and 1 going to 0.
The offset to get 5 to go to 6 is 2.