StartTouch not working ?


I made an entity and I’m trying to detect collisions with ENT:StartTouch.
The problem is that it doesn’t detect any collision (I just put a print() inside StartTouch).
I looked at an other entity using it (AntiNoClip) but it seems that it doesn’t work anymore since the last update…

I think the last update broke this hook… any idea ?

Have you tried regular Touch?

Yes, I tried Touch too. But it’s the same problem, no collision, no message printed…

Show us your code

Ok here’s my code. I took it from the AntiNoClip addon and modified it:

AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
include( “shared.lua” )

function ENT:SetEnt( ent )
if ( string.Left( ent:GetModel(), 1 ) == “*” ) then return end
self.Entity:SetModel( ent:GetModel() )
self.Entity:SetPos( ent:GetPos() )
self.Entity:SetAngles( ent:GetAngles() )
self.Entity:SetParent( ent )
self.Ent = ent
return true

function ENT:Initialize()
self.Ent = self.Ent or self:GetParent()
if ( !self.Ent || !self.Ent:IsValid() ) then self:Remove() end

// Initialise physics.
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )

self.Entity:SetTrigger( true )
self.Entity:SetNotSolid( true )

function ENT:Touch( touched ) – I tried with ENT:Touch and ENT:StartTouch
print(“Entity touched”)

[lua]include( “shared.lua” )

function ENT:Draw()

ENT.Type = “anim”
ENT.Base = “base_anim”

ENT.PrintName = “”
ENT.Author = “”
ENT.Contact = “”

ENT.Spawnable = false
ENT.AdminSpawnable = false[/lua]

function FirstSpawn( ply )
ply:ConCommand(“play intro.mp3”)
local an = ents.Create( “mr_antinoclip_handler” )
an:SetEnt( ply )
ply.AntiNoClip = an
an.Owner = ply

hook.Add( “PlayerInitialSpawn”, “playerInitialSpawn”, FirstSpawn )[/lua]

The entity is created when I spawn and follow me (I can see its shadow on the ground)

Parenting an entity disable all collisions with it from every other entity.
What are you trying to achieve?


If what you want to do is disable noclip for that player then use **[Gamemode.PlayerNoClip](**.

The AntiNoClip addon allow us to add an entity on a prop (the same way as I’m trying to do it here) to catch collisions between that prop and the players. Then the players can’t go through the prop.

What I’m trying to do, is adding an entity on a player to be able to cache collisions between that entity and the world (to disable noclip with world)

The AntiNoClip addon can be found here:
It was perfectly working before the last update

Should be brush and base_brush