So, Tr is not hitting the world. Maybe I'm doing some math wrong?
Code:
function ENT:PhysicsCollide( data, vic )
if data.HitEntity:IsWorld() then
local Tr = util.QuickTrace( data.HitPos+data.HitNormal*(10), data.HitNormal()*(-1), self )
print("Balls "..tostring(Tr.HitSky).." Class "..Tr.Entity:GetClass())
Console:
Balls false Class worldspawn
I am launching this object directly at the skybox from a SWEP.
if SERVER then
local myObj = ents.Create( "myEnt" )
myObj:SetPos( ply:GetShootPos() )
myObj:SetAngles( desVelocity:Angle() )
myObj:SetVelocity( desVelocity*8000 )
myObj:Spawn()
myObj:Activate()
myObj:SetOwner( ply )
myObj:SetNoDraw(true)
local bPhy = myObj:GetPhysicsObject()
if IsValid(bPhy) then
bPhy:AddGameFlag( bit.bor(FVPHYSICS_WAS_THROWN,FVPHYSICS_DMG_SLICE) )
bPhy:Wake()
bPhy:SetVelocity(desVelocity*8000)
timer.Simple(0, function() if IsValid(myObj) && IsValid(bPhy) then
bPhy:EnableGravity(false)
myObj:SetNoDraw(false)
bPhy:SetVelocity(desVelocity*8000)
-- ParticleEffectAttach( "myOldTracer", PATTACH_ABSORIGIN_FOLLOW, myObj, 0 )
end
end )
end
end
What map is this on?
For what it's worth, your math looks fine to me..
gm_Construct and gm_construct_15
You might be hitting a nodraw or playerclip brush - try checking your HitPos and the rest of the trace structure.
That doesn't make sense to me though? It's in gm_construct, and I've tried skybox all around the place.
Looking at the source of util.QuickTrace, your trace is one unit long. Don't use util.QuickTrace.
Oh, you're right. Something in my brain messed up because I thought that trace was 11 units long.
@DarkDragonLove , try data.HitNormal()*(-20) instead of data.HitNormal()*(-1).
Sorry, you need to Log In to post a reply to this thread.