Setting CamPos in Derma

I’m trying to implement the Playermodel into a derma panel. How do I set the campos so its facing the face of the model?

That’s what I have now.



DModel = vgui.Create( "DModelPanel", frame)
		DModel:SetModel(LocalPlayer():GetModel())
		DModel:SetPos(300,10)
		DModel:SetSize(200, 200)
		DModel:SetCamPos(Vector(0, 0, 100))
		DModel:SetLookAt(Vector(0, 0, 20))
end


I’ve been playing with it for a while and I cant figure it out :frowning:

You’re using the right function, but you should check the wiki. It has an example on how to focus in on a particular part of the model

DModelPanel/SetCamPos

[editline]16th February 2016[/editline]


local eyepos = DModel.Entity:GetBonePosition( DModel.Entity:LookupBone( "ValveBiped.Bip01_Head1" ) )
eyepos:Add( Vector( 0, 0, 2 ) )    -- Move up slightly
DModel:SetLookAt( eyepos )
DModel:SetCamPos( eyepos-Vector( -12, 0, 0 ) )

If you’re setting the Z coordinate to be 100 and the others to be 0, then of course it’s going to be above the target

Thanks for the help! This helped alot :slight_smile:

[editline]16th February 2016[/editline]

Yea I wasn’t sure of the axis and how they worked. Thanks anyways :slight_smile: