# Making an Entity rotate?

So this is my question,

I have made an entity and I would like it to spin or if you want, revolve around it’s axis continuously as if it was spinning, but not fast. I don’t know what I should use and when I try using it, it never works.

I don’t know if it should be done on the entity directly from the server by making it change it’s angle constantly, or using cam.3D

If somebody can help or provide a snippet of code to my problem, it would be much appreciated.
Thank you.

If you don’t want any physics involved (setting angular velocity) then you could constantly update its angles in think. Try this:

[lua]
local speed = 20 – Degrees per second
function ENT:Think()
local ang = self:GetAngles();
ang:RotateAroundAxis(self:GetUp(), FrameTime()*speed);
self:SetAngles(ang);
end[/lua]

Its kindda working, but it’s extremely choppy.
There has to be a way around this solution.

Give the entity angular velocity.

I used what you said but it didn’t seem to affect it what so ever, it’s angle switched, but it’s not rotating, I also tested the angle by multiplying it by the curtime and it’s not doing much.

[lua]
function ENT:Draw(ply)

if !self.pos then self.pos = 0 end
self.pos = self.pos + FrameTime() * 20
self.Entity:DrawModel()
self:SetAngles(Angle(0,self.pos,0))
end
[/lua]

It works like a charm, thank you very much.

Why are you doing it in the clientside Draw function?
Draw is for drawing, Think is for this sort of thing.

Also, ENT.Draw doesn’t take any arguments.