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?
[IMG]http://i.imgur.com/NYDxAh0.jpg[/IMG]
That's what I have now.
[code]
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
[/code]
I've been playing with it for a while and I cant figure it out :(
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
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/DModelPanel/SetCamPos"]DModelPanel/SetCamPos[/URL]
[editline]16th February 2016[/editline]
[code]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 ) )[/code]
[QUOTE=AustinH;49750479]DModel:SetCamPos(Vector(0, 0, 100))[/QUOTE]
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
[QUOTE=solid_jake;49750658]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
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/DModelPanel/SetCamPos"]DModelPanel/SetCamPos[/URL]
[editline]16th February 2016[/editline]
[code]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 ) )[/code][/QUOTE]
Thanks for the help! This helped alot :)
[editline]16th February 2016[/editline]
[QUOTE=MPan1;49750698]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[/QUOTE]
Yea I wasn't sure of the axis and how they worked. Thanks anyways :)
Sorry, you need to Log In to post a reply to this thread.