I was making something and I want a brick to follow the mouse but on the nearest surface that the mouse is over. I have this:
wait(.25) mousepointto = mouse.Hit.p brick.CFrame = CFrame.new(mousepointto) mouse.Button1Up:Connect(function() ... end)
inside a while true loop. It works fine but snaps to the position of the mouse and is not able to overlap other object other objects. I want to make the movement smoother and have the ability to overlap objects.
Anyone have any ideas on how I can do this? brick.Position = mousepointto has the same effect as CFrame
The brick does not go through other bricks because... the mouse is 2 dimensional. The hit property of the mouse is the position to where the mouse is pointing, but we only have two dimensions, we don't know if the mouse is 'farther back' or 'forward'. I don't really know how else to explain this, so hopefully, you understand what I am getting at.
I don't really know of a way to do what you are trying to achieve, however, I can suggest one thing: maybe add something to let the players move the item forward/back? Or, just have a 2d placement system where you can only move the item on the X and Y axis.