Limitting flip of an actor
I'm working on some 'attached' turret actors for the Bethesda. Everything's working fairly well (they move with the vehicle etc.) However; they're mounted on both sides and I'm trying to get them to face only one flipped direction (left OR right.)
So far I can make them recognize their current flipped direction (through aim angle) but I don't know if there's a method I can use to then switch them over to the correct direction once I figure out they're facing the wrong way (without just inducing the thing to have a seizure.)
My code for the turret is as follows;
Code:
function Create(self)
self.Flipped = false;
end
function Update(self)
--limit sharpaim
local Aim = self:GetAimAngle(true);
--if self.Flipped==true then
if Aim <= 1.57 then
self:SetAimAngle(1.5);
print(Aim);
local Aim = self:GetAimAngle(true);
print(Aim);
--print("FLIP ME!!!!");
else
--print("DON'T FLIP ME!!!!");
end
--end
end
Flipped is a boolean that is used to read which direction the turret should face.
So I'm wondering if anyone has any ideas on this problem.