Lock Entity Rotation

Title pretty much says it all :stuck_out_tongue:

I searched + had a go at it myself, but its either not working at all or very choppy

Not sure where to go from here, am I meant to be using ENT:PhysicsUpdate or ??

And should I be using SetAngles or something like ComputeShadowControl D:

Depending on which direction you wanted to lock it in, maybe you could do something like

[lua]function ENT:Think()
self:NextThink(CurTime());
local ang = self:GetAngles();
ang.pitch = 0;
self:SetAngles(ang);
return true;
end[/lua]

Perhaps that would work?

Yeah that’s what I had before, only without the NextThink

[lua]self:SetAngles(Angle(0,self:GetAngles().y,0))[/lua]

It’s a lot smoother when think is called more often but I’m open to input if theres a more efficient way, since there will be quite a few of these entities, not sure if calling think that often is bad but… im an optimization freak :3

Edit:

Ok well I managed to get it to stay at the same height, but there are a few side effects :stuck_out_tongue:

If I rotate the ent with physgun on either pitch or roll it seems to start “swaying” and never correct itself, and locking the angles seems to also affect the props movement (as in non-angle movement :P)