non-canCollide models "jump" on each other?

Hello

I have a problem. I have an model, every part in this model is non-canCollide so the parts shouldn’t collide with other parts, but however when a model (with every part non-canCollide) touchs another model (also with every part non-canCollide), the model jumps on the other model

Here is a video:

I have tried setting the mouse target filter on the parent of the models but still nothing

Please help me

maybe put the showcase one to CandCollide , false and than when its placed make it true?

I have already tried everything with canCollide but nothing is working

Many reasons can be behind this behaviour. Sharing the move code would be useful :slight_smile:

  • I guess you use SetPrimaryPartCFrame method to move the model (that could work properly)
  • Does it happen when you move the 2nd model with a script (instead of dragging with mouse)? I’d try it with a loop cycle and see what happens.
  • What is the code of snapping the objects? Can it cause this bug?
  • Does it happen with other models or even with a simple part?
1 Like
  • ye
  • when i set the primary part cframe with a script it doesn’t happen
  • i’m pretty sure it can’t
  • it happens with other models/parts
--snap to grid
function snapToGrid(position)
	return Vector3.new(
		math.floor(position.X/1+0.5)*1,
		position.Y,
		math.floor(position.Z/1+0.5)*1
	)
end

--when mouse moves, the event is fired
function onMouseMove(plr,ray,object,objectHeight,arrow,objectsFolder,plot)
		local ignore = {object,plr.Character}
		local part,position = workspace:FindPartOnRayWithIgnoreList(ray,ignore,false,true)
		
		if part and (not objectPlaced and placing) and (object and (object:FindFirstChild("PLACING") and not object:FindFirstChild("ROTATING"))) then
			if (part==plot or part:IsDescendantOf(plot)) or part:IsDescendantOf(objectsFolder) then
				local newPosition  = snapToGrid(position)
				object:MoveTo(newPosition)
						
				arrow:SetPrimaryPartCFrame(object:GetPrimaryPartCFrame() + ((object:GetPrimaryPartCFrame().LookVector * 3) + Vector3.new(0,objectHeight,0)))
				arrow:SetPrimaryPartCFrame(arrow:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(-90)))
					
				canPlaceObject = true
			else
				canPlaceObject = false
			end
		else
			return false
		end
	end

also, when the mouse moves it creates a ray 100 studs above the mouse.Hit.p with direction Vector3.new(0,-1000,0) so just straight to the ground, just because i can’t set multiple target filters for mouse

  • plr - player
  • ray
  • object - the model
  • objectHeight - model extents size Y (object:GetExtentsSize().Y)
  • arrow - just an arrow that shows you what direction is the model facing, as in the video above
  • objectsFolder - folder where are the objects are stored
  • plot - a part that you can place models on

that is the problem:

“object:MoveTo(newPosition)”

replace it with SetPrimaryPartCFrame… e.g.

object:SetPrimaryPartCFrame(CFrame.new(newPosition))

or

object:SetPrimaryPartCFrame(newPosition)

I’m not sure which one works with the newPosition value.

3 Likes

Wow it works, thank you :slight_smile: :slight_smile: :slight_smile:

1 Like