Placement System

Hey, I was creating a Placement System and was designing my Rotation System so you can rotate things, and I wondered to put the placement system to the mouse position, It works good, but the problem is that it keeps going to the camera, Like the part goes to the mouse position and after that it just tweens to the camera’s position, like the camera is a part.

Is there any way I can fix this?


(a video to understand better whats happening)

I’m guessing the preview part doesn’t have collision so turn off CanQuery if it does have collisions then do this

game.Players.LocalPlayer:GetMouse().TargetFilter = previewpart
4 Likes

yeah i know, thats why i said do targetfilter if it has collision enabled since it’s easier to just disable CanQuery especially if you want to targetfilter something else

1 Like

Oh whoops I misinterpreted your post, that makes sense.

Depending on what you want for your placement system, remove the Y axis like this:

CFrame.new(X, insert_ground_position, Z)

If you’re using the mouse object, do as @4vI7 suggested. If you’re using raycasts, look into RaycastParams.

Yep, It worked perfectly, thanks!!

This would be kind of annoying and hard, cause the player would have multiple grounds and I would need to detect them all.

You can try this piece of code from my placement system:

local function SnapOnTop(Y, Target)
	--Snap on top of parts

	assert(CurrentBlock, ERROR_MESSAGE_NO_ACTIVATION)

	local YPos = Y
	
	if not Target then
		--If it has no target then use the old version
		YPos = Y
		--print(Y)
	else
		YPos += Target.Position.Y + Target.Size.Y / 2 --+ CurrentBlock.PrimaryPart.Size.Y / 2
		--YPos += Target.Size.Y
	end
	
	--print(Target)
	return YPos
end

Y is the origin position(0.5), Target is the part the mouse is on.

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