• Player-Player Collisions
    10 replies, posted
Hello, I'm trying to disable collisions between all players. In my gamemode there's the function "GM:PlayerInitialSpawnRound(pl)" where we can find:     pl:SetNoCollideWithTeammates(true)     pl:SetCustomCollisionCheck(true) How could I disable collisions not only for teammates but between players from two different teams ?
Have a read here: GM/ShouldCollide
Ok, so I could use thise in my autorun ? function PreventPlayerCollision(ply1, ply2) if ply1:IsPlayer() and ply2:IsPlayer() then return false end end hook.Add("ShouldCollide", "prevent players collision", PreventPlayerCollision)
Looks good to me. Just make sure to enable custom collisions for all players (like in the OP).
Ok so it works, we can go throught all players but now there's an issue. There is no more collision between players and bullets what's problematic.
youu could do this hook.Add("PlayerInitialSpawn","no_collision_between_players",function(ply) timer.Simple(0.1,function() if IsValid(ply) then ply:SetCustomCollisionCheck(true) end end) end) hook.Add("ShouldCollide","no_collision_between_players",function(a,b) if a and b and a:IsValid() and b:IsValid() and a:IsPlayer() and b:IsPlayer() then return false end end)
Same issue, players don't get damage when we shoot on them with weapons. But there is blood.
Set the collision group of the player using Entity/SetCollisionGroup to something like COLLISION_GROUP_PASSABLE_DOOR and see if the issue persists
Ok so like this ? pl:SetCollisionGroup( COLLISION_GROUP_NONE )
Maybe I should do it in an other way ?
Please I need your help, if anyone has an idea I would really appreciate to know it.
Sorry, you need to Log In to post a reply to this thread.