Players view glitching under the ground

This works perfectly in singleplayer, but in multiplayer when you walk, the camera glitches under the ground and when you stand still the camera is a tiny bit glitchy and jumps up and down a little.



concommand.Add( "melon", function( ply, cmd, args )
	ply:SetModel("models/props_junk/watermelon01.mdl");
	ply:SetHullDuck( Vector(-10, -10, -10), Vector(10, 10, 10) );
	ply:SetHull( Vector(-10, -10, -10), Vector(10, 10, 10) );
	ply:SetViewOffset( Vector(0, 0, 10) );
	ply:SetViewOffsetDucked( Vector(0, 0, 10) );
	ply:SetModelScale( 1, 0 );
	ply:SetRunSpeed(1000);
	ply:SetWalkSpeed(600);
	print( "You turned into a living melon!" )
end )


Hull, view offset, speeds, and model scale are all shared. You have to have them synchronize between the server and the client you set it on. This means sending a netmessage to the client which sets all these values for them.

Because these functions are executing on the server, the server calculates physics etc just fine, but the client still thinks its a human-sized entity and the server’s telling it to move belowground/walk and run at different speeds than it expects etc. This conflict is what’s causing glitchiness and rubberbanding.

Oooh, I didnt think about that. Thank you. Got it to work now! :smiley: