All pastes #606781 Raw Edit

Bearing/elevation code

public text v1 · immutable
·published 2007-07-07 02:41 UTC
rendered paste body
local trace = util.GetPlayerTrace(self.Ply)
trace.Filter = self.Pod
self.VPos = util.TraceLine(trace).HitPos
local BeaconPos = self.VPos
local DeltaPos = self.Entity:WorldToLocal(BeaconPos)
brng = DeltaPos:Angle()
local pitch = brng.p
local yaw = brng.y
if (pitch > 180) then pitch = pitch - 360 end
if (yaw > 180) then yaw = yaw - 360 end
if (pitch < -180) then pitch = pitch + 360 end
if (yaw < -180) then yaw = yaw + 360 end
Wire_TriggerOutput(self.Entity, "Bearing", yaw + 90)
Wire_TriggerOutput(self.Entity, "Elevation", -pitch)