I’m trying to make a simple turret sent where your seat/turret turn with you. Here’s what I have so far:
local pl = self.Seat:GetDriver()
if ValidEntity( pl ) then
local ang = pl:GetAimVector():Angle() local seatyaw = self.Seat:GetAngles().yaw if math.abs( seatyaw - (ang.yaw - 100) ) > 30 then local n = Lerp(0.05,seatyaw,ang.yaw-100) print(n) self.Seat:SetAngles( Angle( 0,n, 0 ) ) end end
Basically, when you look left/right it turns left/right. However, for values of “n” around -30 and 200, the thing starts to spazz. Like, if I keep looking in that direction, it tries to turn but keeps resetting to 20ish degrees before. Any clue on how I can fix this?