[B][highlight]DataTable warning: player: Out-of-range value (351.650513) in SendPropFloat 'm_angEyeAngles[0]', clamping.[/highlight][/B]
While (in my 2D GM) i turn left, it gives that error.
May it be this?
[lua]function GM:CreateMove( cmd )
local Pl = LocalPlayer()
local MousePosition = gui.ScreenToVector(gui.MousePos())
local MousePositionx, MousePositiony = gui.MousePos()
cmd:SetForwardMove( cmd:GetSideMove() )
local shootingpos = ( Pl:GetShootPos() ):ToScreen()
--if ydiff <= 0 then
local ang = math.Rad2Deg( math.atan2( (MousePositiony - 10) - shootingpos.y, (MousePositionx - 10) - shootingpos.x ) )
--end
if MousePosition.y <= 0 then
cmd:SetViewAngles( Angle( ang, -90, 0 ) )
else
cmd:SetViewAngles( Angle( 180 - ang, 90, 0 ) )
cmd:SetForwardMove( -cmd:GetSideMove() )
end
cmd:SetSideMove( 0 )
end [/lua]
Just incase you're wrong: Normalise your angles before setting them.
[QUOTE=|FlapJack|;23650045]Just incase you're wrong: Normalise your angles before setting them.[/QUOTE]
[code]attempt to index local 'ang' (a number value)[/code]
Doing "ang" normalized.
ang.p = math.NormalizeAngle(ang.p)
And so on for y , r
[QUOTE=|FlapJack|;23650252]ang.p = math.NormalizeAngle(ang.p)
And so on for y , r[/QUOTE]
But ang is just a number, it hasn't got yaw, roll and pitch.
Its the map [i]possibly[/i]
Edit
There are reports of it from tf2 so an engine bug?
[QUOTE=Wolfo;23659914]But ang is just a number, it hasn't got yaw, roll and pitch.[/QUOTE]
No no, I meant normalise each individual part of your angle before you set it.
Instead of ucmd:SetViewAngles(ang) do
ang.p , ang.y , ang.r = -- normalise p , y , r
ucmd:SetViewAngles(ang)
Just saw you posted the code. I'll show you why it shows engine errors.
[editline]12:34AM[/editline]
[lua]function GM:CreateMove( cmd )
local Pl = LocalPlayer()
local MousePosition = gui.ScreenToVector(gui.MousePos())
local MousePositionx, MousePositiony = gui.MousePos()
cmd:SetForwardMove( cmd:GetSideMove() )
local shootingpos = ( Pl:GetShootPos() ):ToScreen()
--if ydiff <= 0 then
local ang = math.Rad2Deg( math.atan2( (MousePositiony - 10) - shootingpos.y, (MousePositionx - 10) - shootingpos.x ) )
ang = math.NormalizeAngle(ang) -- ang is 359 or something, instead it needs to be 179
--end
if MousePosition.y <= 0 then
cmd:SetViewAngles( Angle( ang, -90, 0 ) )
else
cmd:SetViewAngles( Angle( 180 - ang, 90, 0 ) )
cmd:SetForwardMove( -cmd:GetSideMove() )
end
cmd:SetSideMove( 0 )
end [/lua]
[QUOTE=|FlapJack|;23671174]No no, I meant normalise each individual part of your angle before you set it.
Instead of ucmd:SetViewAngles(ang) do
ang.p , ang.y , ang.r = -- normalise p , y , r
ucmd:SetViewAngles(ang)
[/QUOTE]
I still don't get why are you normalizing the pitch, yaw and roll of [B]one[/B] angle...
As shown in the code ang is just a number not a whole angle.
[QUOTE=Wolfo;23681110]I still don't get why are you normalizing the pitch, yaw and roll of [B]one[/B] angle...
As shown in the code ang is just a number not a whole angle.[/QUOTE]
See his edit, he's normalizing ang.
I already tried what's in his edit and it didn't work(same bug).
Change line 17 to
[lua]cmd:SetViewAngles( Angle( math.NormalizeAngle( 180 - ang ), 90, 0 ) )[/lua]
Since normalized angle is between -179 to 180. 180 - (-171) would be 351, like in your error.
[QUOTE=raBBish;23684556]Change line 17 to
[lua]cmd:SetViewAngles( Angle( math.NormalizeAngle( 180 - ang ), 90, 0 ) )[/lua]
Since normalized angle is between -179 to 180. 180 - (-171) would be 351, like in your error.[/QUOTE]
Thanks a thousand! That's perfect :holy:
Sorry, you need to Log In to post a reply to this thread.