• Unusual Impact Effect Behaviour
    2 replies, posted
I'm doing a simple util.TraceLine from the player's shoot position, to however forward their reach is. If they hit, I dispatch an impact effect. The effect will apply the decal in the right place, but then emit the particles in a completely different place.. [lua] if tr.Hit then local data = EffectData() data:SetOrigin(tr.HitPos) data:SetNormal(tr.HitNormal) data:SetAngles(tr.HitNormal:Angle()) data:SetEntity(tr.Entity) data:SetSurfaceProp(tr.SurfaceProps) util.Effect("impact", data) end[/lua] Here's the 5mb monochrome gif demonstrating: [img]http://puu.sh/96eLW/b6d9b087ab.gif[/img]
What is the Trace code; it may be messed up. Also there is this: [url]http://wiki.garrysmod.com/page/Entity/DispatchTraceAttack[/url] -- you may be using it; if you are then just post the entire function.
I said I'm using util.TraceLine. [lua] local tr = util.TraceLine({ start = self.Owner:GetShootPos(), endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.Reach, filter = self.Owner, mask = bit.bor(MASK_SOLID, MASK_WATER) })[/lua] There's nothing before this snippet, and right after it is the effect.
Sorry, you need to Log In to post a reply to this thread.