Get a good view to the model in the DModelPanel

Hello,
I have this VGUI:

It’s a dialog system with NPCs and the DModelPanel should display the model in a correct way (so that you can see the head and a bit of below). I can’t get it to work, the different code samples from the wiki didn’t work, the model is too near and is positioned different with a different display resolution. I also can move the whole panel and so can “explore” the model, because the model doesn’t move, only the excerpt.

Does anybody has an Idea?

Current code is:



local modelPanel = vgui.Create( "DModelPanel", topPanel )
modelPanel:DockMargin( 5, 5, 5, 5 )
modelPanel:Dock( LEFT )
modelPanel:SetModel( npc:GetModel( ) )
modelPanel:SetWide( 100 )
modelPanel:SetAnimated( false )

function modelPanel:LayoutEntity( Entity ) end

local eyepos = modelPanel.Entity:GetBonePosition( modelPanel.Entity:LookupBone( "ValveBiped.Bip01_Head1" ) )
eyepos:Add( Vector( 0, 16, 38) )
modelPanel:SetLookAt( eyepos )
modelPanel:SetCamPos( eyepos-Vector( -230, 0, 0 ) )

This code makes it look good, but only on a specific resolution.

Have you tried the code from the example in

DModelPanel:SetLookAt? Seems to me like it’s doing exactly this.

One thing I would change from that example, though, is make the distance bigger (-15 would be something like -60) and set the FOV smaller with

DModelPanel:SetFOV.