No-Collide Vehicles


function GM:ShouldCollide( victim, killer )
    if victim:IsPlayer() and killer:IsVehicle() then 
        constraint.NoCollide( victim, attacker, 1, 0 );
    end
    return true
end

I’m trying to use that code, it kinda works but, the car go through people but the player get stuck on the car if he jumps or walk to the car, or if the car stop while the player is inside the car, the player can’t walk!

-bump-

I don’t think you can put constraints on players.

How come no-collide tool, when you right click with it in a vehicle, you can go through it without getting stuck and vice-versa?

Because it puts the Collision Group to a certain one that doesn’t interact with anything but the world?

COLLISION_GROUP_WEAPON
Would be good to use if you wa t to collide with everything but players.

I want to no collide only with the player, but still collide with props, so people don’t abuse to go through other’s base!

This should work:


hook.Add("PlayerSpawnedVehicle", "NoCollideVehicle", function(ply, vehicle)
	vehicle:SetCollisionGroup(COLLISION_GROUP_WEAPON) 
end)

Thank you good sir! It works!