CalcView angle question

Basically I want the view of the player always in front of him but I don’t really know how to do that (I’ve some issues with the angles)
I’ve done that so far :

local function CamFront( ply, pos, angles, fov )
	local view = {}
	local CamPos=  angles:Forward()*100
	view.origin = pos+ ( Vector(-CamPos.x,CamPos.y,-3) )
	view.angles = -Angle(0,angles.y,0)
	view.fov = fov
	view.drawviewer = true

	return view

hook.Add( "CalcView", "MyCalcView", CamFront)

but this gave me this result:

Do you have any idea of how doing it ?

Video is private


You should use the angle of the vector ‘CamPos’:


Something like:

view.angles = CamPos:Angle()

But i don’t understand what you want exactly.
When you say “view of players always in front of him”, it is in front of his head (so using the up/down axis) or in front of his ‘torso’ ?

I tried but it does the exact same thing :s

More like he holds a selfi stick

Then simply place the camera in front of the player face

local camPos =  angles:Forward() * 100 // Get the vector 100 unit away of the player face
view.origin = pos + camPos // Add it to the player shoot pos

And revert the angle, because the phone look at the invert of the player

view.angles = -angles // Invert the angle, like he have eyes behind his head

ps: not tested, but it should give you enough to fix it