its been called from module script that maintain the placement system in replicated storage:
local function onRenderStepped()
mousePosition = Get3dMousePosition(raycastParams)
if snapToGrid then mousePosition = PlacementValidator.SnapToGrid(mousePosition) end
local cframe = CFrame.new(mousePosition) * CFrame.fromEulerAnglesYXZ(0, math.rad(currentAngle), 0)
local size = if itemClone:IsA("Model") then itemClone:GetExtentsSize() else itemClone.Size
local isValid = PlacementValidator.IsValid(cframe, size)
boxOutline.SurfaceColor3 = if isValid then VALID_COLOR else INVALID_COLOR
itemClone:PivotTo(cframe)
end
I don’t know why it’s not working, I hope you understand that. i need to disable the collision between objects. as you said I have tried include that folder “WhitelistedToPlace” and “PlacedProducts”
PlacedProducts is the folder when the object is placed in its his parent(workspace).
WhitelistedToPlace is the folder that includes the placeable objects like shelf or something in my case that floor platform
I don’t know why it’s not working, I hope you understand that. i need to disable the collision between objects. as you said I have tried include that folder “WhitelistedToPlace” and “PlacedProducts”
PlacedProducts is the folder when the object is placed in its his parent(workspace).
WhitelistedToPlace is the folder that includes the placeable objects like shelf or something in my case that floor platform
i’m unable to write code for you right now but I can hopefully push you in the right direction
for the height limit, since you want specifically 3 objects to be placed on one another regardless of size, whenever you place an object, detect if it’s on top of 3 or more other objects, and if so, cancel the function.
you can use the same logic for collision, using WorldRoot:GetPartsInPart() the server can check if the part is in another object’s hitbox.
i am 100% sure that its need to be changed in the PlacementValidator script, because its his main goal. to validate a placement, that means that it needs to check if any objects colliding and to set max height
I’ve look at more than a few of these for direction: This one clearly stands out after an update.
You may want to take a look at how this was put together…
Hold the object in front of the other; it becomes solid, then it will allow it to be stacked.
He has a bit of play between solid and non-collectible, depending on where you’re holding it at the moment. Once solid, move upwards. Figure out how he’s doing that part when they are acting as solids. Your answer is right there … revere engineer that.
I also found it impressive how far you can place objects away from yourself and how you can change your view angle (not the object) while holding an object. Good stuff, a lot to learn for that one.
you could possibly have some sort of invisible part, and upon the player trying to place anything,
you check if any of the chosen building parts are touching the height part, if they are, cancel the placement
Region3 or some variant, it will loop through all of the colliding parts, maybe check if the part is of parent of model
local getTouchingParts = game.Workspace:FindPartsInRegion3() -- gets table of all parts in region3
for i,v in pairs(getTouchingParts) do --loops through the table
print(v.Name) -- prints name of the part in the loop right now
--
if v.Parent.Name == "Table" then
--not valid
end)
end
And for the height limit you could probably solve something like that also using region3 and Y data