-
What do you want to achieve? Keep it simple and clear!
completely disable all collisions for all parts of a character’s body -
What is the issue? Include screenshots / videos if possible!
its a question -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Searched a while online, cancollide is forced on renderstep by humanoids, I heard somewhere a long time ago that a certain humanoid state might do this, but un sure
That’s not what I’m looking for, I’m looking to completely disable all collisions for all body parts on any part, not just other players
You can disable the default collision group using the collision group system.
Edit: Just do this as it’s a better solution than the renderstep.
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
local playerCollisionGroupName = "Players"
PhysicsService:CreateCollisionGroup(playerCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(playerCollisionGroupName, playerCollisionGroupName, false)
--The key is here to make it not collide with the default enviroment
PhysicsService:CollisionGroupSetCollidable("Default", playerCollisionGroupName, 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 onCharacterAdded(character)
setCollisionGroupRecursive(character)
character.DescendantAdded:Connect(setCollisionGroup)
character.DescendantRemoving:Connect(resetCollisionGroup)
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)
3 Likes