I made a entity but it doesn't collide with player.
[code]
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:SpawnFunction( ply, tr, ClassName )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local ent = ents.Create( ClassName )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:SetOwner(ply)
ent:Activate()
return ent
end
function ENT:Initialize()
self:SetModel(self.Model)
self:PhysicsInit( SOLID_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetUseType(ONOFF_USE)
local phx = self:GetPhysicsObject()
if(IsValid(phx)) then
phx:Wake()
end
end
[/code]
I can simply walk trough it, I cannot interact with it using physgun nor use it with E. Gravity gun works normally
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetOwner]Entity:SetOwner[/url]
[quote]
[B]Sets the owner of this entity , disabling all physics interaction with it.[/B]
[/quote]
Don't use setowner if you want collisions with the player.
Ohh, I didn't thought about it, thank you :)
Sorry, you need to Log In to post a reply to this thread.