Hello, i’m trying to do a dummy can pass trouigh walls and players but i readed the PhysicService and CollisionGroups and i never made it work, how i can do please ?
Have you tried turning the dummy’s “HumanoidRootPart” Collision off?
Maybe you should read this article, It might help with CollisionGroup although it’s for a player.
I already readed but i don’t found what i searsh exactly.
Unfortunately, I don’t really know how to solve that problem. But I hope you will find the proper solution soon! Thank you.
Do you have parts/meshes inside the body parts?
I don’t have anything else in the dummy just a dummy in R6 and the mesh for head(part with SpecialMesh) to round it
Ok, Try turning the CanCollide off in the specialMesh.
If that doesn’t work try using r15 instead of r6
This is not the problem i need a script because CanCollide can’t be turned on Torso but i just don’t know how.
Hmm, I usually just turn cancollide of and it works for me
I’ve never used r6 so I can’t really tell, Try using r15 rig models and see if that works
I can only use R6 for what i want to do sorry.
I see, I think there might be some videos covering that topic up on yt.
Have a look at those and you might find a solution!
/Primal Dev
I already go watched videos about it but always its not what i want to do.
Hmmm, I can’t do much
Hopefully, you will find your solution soon!
/Primal Dev
Edited the roblox one, mentioned by @Pinguch52 in the player-player collision link
local PhysicsService = game:GetService("PhysicsService")
local npcCollisionGroupName = "npc"
local otherCollisionGroupName = "others"
PhysicsService:CreateCollisionGroup(playerCollisionGroupName)
PhysicsService:CreateCollisionGroup(otherCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(npcCollisionGroupName, otherCollisionGroupName, false)
local previousCollisionGroups = {}
local function setCollisionGroup(object)
if object:IsA("BasePart") then
previousCollisionGroups[object] = object.CollisionGroupId
PhysicsService:SetPartCollisionGroup(object, playerCollisionGroupName)
end
end
local function setCollisionGroupRecursive(object)
setCollisionGroup(object)
for _, child in ipairs(object:GetChildren()) do
setCollisionGroupRecursive(child)
end
end
local function resetCollisionGroup(object)
local previousCollisionGroupId = previousCollisionGroups[object]
if not previousCollisionGroupId then return end
local previousCollisionGroupName = PhysicsService:GetCollisionGroupName(previousCollisionGroupId)
if not previousCollisionGroupName then return end
PhysicsService:SetPartCollisionGroup(object, previousCollisionGroupName)
previousCollisionGroups[object] = nil
end
local function onChildAdded(child)
setCollisionGroupRecursive(child)
child.DescendantAdded:Connect(setCollisionGroup)
child.DescendantRemoving:Connect(resetCollisionGroup)
end
for _, v in pairs(workspace:GetDescendants()) do
onChildAdded(v)
end
workspace.DescendantAdded:Connect(onChildAdded)
I’m beginner and i don’t understand anything on it, i don’t have this level at all all this script just for a little thing ? Also when i try i get that : Could not create collision group, one with that name already exists.
local PhysicsService = game:GetService("PhysicsService")
local GroupName = "DummyCollision"--The name we will be giving to the group
PhysicsService:CreateCollisionGroup(GroupName)--This creates the colliion group
PhysicsService:CollisionGroupSetCollidable(GroupName,GroupName,false)--(Group1,Group2,Can they collide?)
local Dummy = game.Workspace:WaitForChild("Mech")--This waits until the dummy loaded into the game
for _,Part in ipairs(Dummy:GetDescendants()) do -- This is a loop that goes threw everything in a table( for example this dummy we are looping threw its assets)
--We use GetDescendants() for we can get everything within the model
if Part:IsA("BasePart")--[[This is the class name]] then
PhysicsService:SetPartCollisionGroup(Part,GroupName)--Adds the part to the chosen collisiongroup
end
end
It’s physicsService, you create collision groups for whatever items you want, and set their canCollide to whatever you want, without actually changing their canCollide property, to fix your problem, change the names at the start, so like, change npc to dummy and others to otherThings or whatever you want to call them.
I made some mistakes since I was editing the one made by roblox and was writing on phone, this is (hopefully) the fixed code.
local npc = --path to your npc / dummy
local PhysicsService = game:GetService("PhysicsService")
local npcCollisionGroupName = "npc"
local otherCollisionGroupName = "others"
PhysicsService:CreateCollisionGroup(npcCollisionGroupName)
PhysicsService:CreateCollisionGroup(otherCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(npcCollisionGroupName, otherCollisionGroupName, false)
local function setCollisionGroup(object)
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, otherCollisionGroupName)
end
end
local function setCollisionGroupRecursive(object)
setCollisionGroup(object)
for _, child in ipairs(object:GetChildren()) do
setCollisionGroupRecursive(child)
end
end
local function onChildAdded(child)
setCollisionGroupRecursive(child)
child.DescendantAdded:Connect(setCollisionGroup)
end
for _, v in pairs(workspace:GetDescendants()) do
if child ~= npc and not child:IsDescendantOf(npc) then
onChildAdded(v)
else
PhysicsService:SetPartCollisionGroup(object, npcCollisionGroupName)
end
end
workspace.DescendantAdded:Connect(function(child)
if child ~= npc and not child:IsDescendantOf(npc) then
onChildAdded(child)
else
PhysicsService:SetPartCollisionGroup(object, npcCollisionGroupName)
end
end)