I am making a HUD that displays a player model on it. It is working perfectly but I can not seem to make it stop spinning. I know I am supposed to use PlayerModel:SetAnimated(false); but that doesnt seem to work. The person I took the code from said that he didnt know how to fix the issue. He tried something with PlayerModel.bAnimated = false; but that didn’t seem to work. It did not break my code though so I did not decide to take it out. Here is the code:
hook.Add("HUDPaint", "PlayerModel", function( ) local _p = LocalPlayer( ); // Make sure valid player, otherwise model won't work if ( !IsValid( _p ) ) then return; end // Useful vars we reuse... local _model = _p:GetModel( ); // Make sure the vgui element hasn't been made... if ( !PlayerModel || !ispanel( PlayerModel ) ) then PlayerModel = vgui.Create( "DModelPanel" ); PlayerModel:SetModel( _model ); PlayerModel.__Model = _model; PlayerModel:SetPos( 20, ScrH( ) - 150 ); PlayerModel:SetAnimated( false ); PlayerModel.bAnimated = false; -- SetAnimated should access this, but not sure why it doesn't.. May be a parent panel that takes it over, this should be corrected and I'll look into a fix for it. PlayerModel:SetSize( 130, 130 ) PlayerModel:SetCamPos( Vector( 18, 4, 60 ) ); PlayerModel:SetLookAt( Vector( 0, 0, 60 ) ); PlayerModel:ParentToHUD( DrawMyHud ); -- If it is used on the hud... end // Update the model if it changes if ( _p:GetModel( ) != PlayerModel.__Model ) then PlayerModel:SetModel( _model ); PlayerModel.__Model = _model; end // Draw it.... -- up to you. end );
Can you figure something out?