How do I make a non-physic prop rotate smoothly?

Hello,

I’m currently making a bunker entity and I want it to rotate slowly and smoothly when firing.

I tried by changing its angles with “SetAngles()” at each call of Think() but it’s not smooth and I can’t control the speed effectively.

Is there any function or any good way of doing this in gmod12?

Were you doing ENT:Think or the Gamemode Think?

If you do it with Gamemode Think it should be smooth enough. And you should be able to control speed if you throw in some time conditions.

[lua]
g_ent = your_ent – the entity that you created

local n = CurTime()
hook.Add(“Think”, “Rotate”, function()
if n < CurTime() then
g_ent:SetAngles(g_ent:GetAngles()+Angle(0,1,1))
n = CurTime() + 0.05
end
end)[/lua]

Something like this should work in theory. You could also just throw in some table where you store the entities that you need to rotate, and just loop through it, or idk. But that should work and be smooth enough, although you might need to have to play with the delay.

P.S. Or the most silly way:
[lua]timer.Create(g_ent, 0.05, 0, function()
g_ent:SetAngles(g_ent:GetAngles()+Angle(0,1,1))
end)[/lua]

Although I wouldn’t do that, you could try.