• Player Traceline
    5 replies, posted
I have an addon that replaces sprays with a emblem the user creates and I'm attempting to make it if they are looking directly at the emblem it prints the sprayers name in chat. But when I use eyetrace it doesn't count the sent as an ent ? When looking at the sent all it prints is "worldspawn" when it should be printing "sent_emblem". I feel like this is a problem with the entity and not my trace code? Anyway to solve this? [CODE] hook.Add( "Think", "EmblemTracer", function() local ply = LocalPlayer() local trace = ply:GetEyeTrace() print( trace.Entity:GetClass() ) end) [/CODE]
Not sure on the rules for bumping, But I would appreciate a reply.
Are you sure the emblem is an entity? This seems strange Edit: Try this just to be sure [url]https://wiki.garrysmod.com/page/ents/FindByClass[/url]
If your ent doesnt have a physic object, then traces wont work with it
[QUOTE=gonzalolog;51140686]If your ent doesnt have a physic object, then traces wont work with it[/QUOTE] I've attempted to set its physics but it still returns "worldspawn" [CODE] function ENT:Initialize() self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) local phys = self:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() end end [/CODE]
It wont have a collision model, thats why it returns worldspawn
Sorry, you need to Log In to post a reply to this thread.