How to use RotateAroundAxis properly?

I am using cam3D2D on a entity and I need to rotate the 3d2d. I am trying to use RotateAroundAxis but its giving me errors, what am I doing wrong.



	local pos = self:GetPos() + self:GetAngles():Up() * 60 + self:GetAngles():Forward() * 15
	local angle = self:GetAngles() * self:GetAngles():RotateAroundAxis(Vector(10,10,10),10)

	cam.Start3D2D(pos, angle, .1)
             // drawing stuff
        cam.End3D2D()


rotatearoundaxis applies a transformation to an angle based on the given vector direction.

The main purpose is to apply transformations without worrying about gimbal lock

[lua]
ang:RotateAroundAxis( vec:Up(), 45 )
ang:RotateAroundAxis( vec:Left(), 45 )
ang:RotateAroundAxis( vec:Forward(), 45 )
[/lua]

This is functionally identical to doing this;
[lua]
local myAng=Angle(45,45,45)
local myRotatedAng=ent:LocalToWorldAngles( myAng )


local myAng=Angle()
local myEntAng=ent:GetAngles()

myAng:RotateAroundAxis(myEntAng:Up(),45)
myAng:RotateAroundAxis(myEntAng:Left(),45)
myAng:RotateAroundAxis(myEntAng:Forward(),45)
[/lua]

Personally i’ve never seen the appeal.

Thanks so much! Very helpful! But I am confused on something. What does “vec” stand for?

Here is my code and I am getting a error



drill:SetAngles(drill:GetAngles():RotateAroundAxis(drill:GetAngles():Up(),45))


^^ Drill is a Entity ^^

it’s meant to be ang, not vec. typo ;o

and to repeat myself;

meaning it doesn’t return anything so you can’t use it like that.

this is similar to the behaviour of this function: http://wiki.garrysmod.com/page/Vector/Normalize

Im still confused, how do I use it?

To repeat myself, Again,

except use ent:GetAngles() as “myAng”.
Then just do ent:SetAngles(myAng)

I tried doing this and it still didnt work?



local setAng = Angle()
local setEntAng = ent:GetAngles()

drill:SetAngles(setAng:RotateAroundAxis(setEntAng:Up(), 90))



Breaks out the spoon

[lua]
local myAng = ent:GetAngles()
local entAng = ent:GetAngles()

myAng:RotateAroundAxis(entAng:GetUp(),90)

drill:SetAngles(myAng)
[/lua]