You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to create a building system that works with multiple sized blocks and snaps their faces together perfectly - What is the issue? Include screenshots / videos if possible!
When I have an irregular sized block (regular is 4x4x4, an irregular is 4x4x8 for example) I get weird offsets in position. - What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I only know that it happens when some of the normal axis are either positive or negative, and none of the creator hub solutions I found helped me. I tried to offset it back if the normal’s Z is negative, but that worked weirdly, sometimes it didnt do anything, sometimes it made it worse.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Below I listed the main CFrame calculation section that determines the position and the orientation of the placed block depending on some factors.
local cframe = CFrame.new(raycast.Position + (raycast.Normal * partModel.Size/2))
if raycast.Instance:HasTag("Part") then -- the part tag just determines if its a player placed block
local normalMax, axi = GetLargestValueFromVector3(raycast.Normal)
local offset = raycast.Normal * (partModel.Size[axi])
cframe = raycast.Instance.CFrame + offset
if raycast.Instance.Size ~= partModel.Size then
offset = ((raycast.Normal * (raycast.Instance.Size[axi]))/2)
+ ((raycast.Normal * (partModel.Size[axi]))/2)
cframe = raycast.Instance.CFrame + offset
end
end
