Entity Position

I want the following code to activate when the entity is upside down. I think I have a guess why its wrong and that is because I am probably comparing all three angles with a number, but I only want to use the roll angle. Is there any code that will only use the roll angle instead of all three (pitch, yaw, roll)?


function ENT:Think()
	local i = self.Entity:GetAngles()
	if i < 90 && i > -90 then
		self:AttemptJump()
	else
		self:AttemptFix()
	end
end

index the roll of the angle table

GetAngles().r or getAngles().roll

GetAngles() returns an angle.

You can’t compare ang(90,120,0) and 90
(the angle is made up)

try something like



local Pitch = self.Entity:GetAngles().pitch
local Yaw = self.Entity:GetAngles().yaw
local Roll = self.Entity:GetAngles().roll
if Pitch > 90 or Pitch < -90 or Yaw > 90 or Yaw < -90 or Roll > 90 or Roll < -90 then
    DO_STUFF()
end


EDIT: DAMN YOU VEXX!
Ninja’d

Lol, Thank you guys.