Properly Making a Trigger SENT

So i’m trying to make a fire entity. When a player walks within its bounds, they are ignited.

I have it working more or less, but the bounds are not proper. I’ve been fucking with debugoverlays and they don’t seem to make any sense of my situation.

The SENT is not a brush entity.

[lua]
ENT.Bound = 150

function ENT:Initialize()

self.Entity:SetModel( "models/Roller.mdl" ) //remove this

self.Entity:SetMoveType( MOVETYPE_NONE )
self.Entity:SetSolid( SOLID_VPHYSICS ) // should this be vphysics?

self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
self.Entity:SetCollisionBounds( Vector( -self.Bound, -self.Bound, -self.Bound ), Vector( self.Bound, self.Bound, self.Bound ) ) 
self.Entity:SetTrigger( true )
self.Entity:DrawShadow( false )

end[/lua]

The bounds ingame seem way too small for the size of its collision bounds…

I had this same problem, I don’t think the collision bounds work properly, no matter what size I tried it wouldn’t work. My solution was to send out a trace:
[lua]function ENT:Think()

for _,ply in ipairs(player.GetAll()) do
	
	local coinPos =  self:LocalToWorld(self:OBBCenter())
	local plyPos = ply:LocalToWorld(ply:OBBCenter())
	
	local trd = {}
	trd.start = coinPos
	trd.endpos = coinPos + (plyPos - coinPos):GetNormal()*60
	trd.filter = {self}
	local tr = util.TraceLine(trd)
	
	debugoverlay.Line(trd.start, trd.endpos)
	
	if tr.Hit and tr.Entity == ply then
		self:Touch(ply)
	end
	
end

end[/lua]

i was hoping to avoid hacky methods but i guess i could just do a check with self.Entity:GetPos():Distance( target:GetPos() ) if i really had to.

Couple of things:
[ul]
[li]set the movetype to SOLID_BBOX,
[/li][li]throw in a self:PhysicsInitBox( Vector( -self.Bound, -self.Bound, -self.Bound ), Vector( self.Bound, self.Bound, self.Bound ) )
[/li][li]The player won’t collide with COLLISION_GROUP_DEBRIS
[/li][li] self == self.Entity
[/li][li] It’s better to use ents.FindInBox as it’s faster.
[/li][/ul]
Hope that helps.

Players can collide with my SENT, i think it’s because i’ve set it to be a trigger.

other than the collision, do my other suggestions help?

the BBOX thing works.

This type of thing should be a point entity, not a trigger, it would also ease the creation of it.

Did you even read what he wanted to do

“When a player walks within its bounds, they are ignited.” http://developer.valvesoftware.com/wiki/Env_fire

If he was just making an entity which ignited a player within its bounds without any effects, then it’d be better to fall back on a trigger. If you’re creating a fire effect, you’ll want to apply damage at an interval based on how close the player is to the epicenter.

-snip-

[lua]function ENT:Initialize()

local radius = Vector( 24,24,24 )

self:SetCollisionBounds( radius * -1, radius )
self:SetMoveType( MOVETYPE_NONE )
self:SetSolid( SOLID_VPHYSICS )
self:PhysicsInitSphere( radius.x )
self:SetNotSolid( true )
self:SetTrigger( true )
self:SetModel( MODEL )	

end

function ENT:Touch( ent )
if( !IsValid( ent ) || !ent:IsPlayer() ) then return end

-- Do stuff

end
[/lua]

This works for me.

yeah there are a few ways to do it. SOLID_BBOX seems to accurately use the collision bounds for detection so i’m using that currently.

It does, but I believe it’s axis-aligned—if your entity has any rotation applied to it, it won’t affect the actual area of collision.

I’m not rotating it so that worked out in my favor.