So I used ply:SetModelScale( self:GetModelScale() * 2, 0 ) to scale a player up. The problem is that their cameras are still in the same position from before the scale. Is there a way to also get that to scale/move up?
Would I use Player:SetCurrentViewOffset or Player:SetViewOffset to achieve this? If so could some give me an example of it?
You can use PLAYER:SetViewOffset and PLAYER:SetViewOffsetDucked.
Here's the way I've approached it. PAC3 may have a better implementation for it, though you'll have to do some digging around. I use fixed hull sizing because it gets extremely annoying when players at size 20 start blocking everyone else from moving around.
[CODE]local VIEW_OFFSET = Vector( 0, 0, 64 )
local VIEW_OFFSET_DUCK = Vector( 0, 0, 28 )
local HULL_MIN = Vector( -16, -16, 0 )
local HULL_MAX = Vector( 16, 16, 72 )
local HULL_DUCK_MIN = Vector( -16, -16, 0 )
local HULL_DUCK_MAX = Vector( 16, 16, 36 )
local STEP_SIZE = 18
local PLAYER = FindMetaTable( "Player" )
function PLAYER:SetSize( size )
size = math.Clamp( size, 0.01, 20 ) -- if you don't clamp it at around 20, they will start lagging the server when they walk
self:SetModelScale( size, 0 )
self:SetViewOffset( size * VIEW_OFFSET )
self:SetViewOffsetDucked( size * VIEW_OFFSET_DUCK )
self:SetStepSize( size * STEP_SIZE )
if ( size == 1 ) then
self:ResetHull()
elseif ( size < 1 ) then
self:SetHull( HULL_MIN, size * HULL_MAX )
self:SetHullDuck( HULL_DUCK_MIN, size * HULL_DUCK_MAX )
else
self:SetHull( HULL_MIN, HULL_MAX )
self:SetHullDuck( HULL_DUCK_MIN, HULL_DUCK_MAX )
end
end[/CODE]
Hope this helps.
[QUOTE=Mista Tea;46515475]You can use PLAYER:SetViewOffset and PLAYER:SetViewOffsetDucked.
Here's the way I've approached it. PAC3 may have a better implementation for it, though you'll have to do some digging around. I use fixed hull sizing because it gets extremely annoying when players at size 20 start blocking everyone else from moving around.
[CODE]local VIEW_OFFSET = Vector( 0, 0, 64 )
local VIEW_OFFSET_DUCK = Vector( 0, 0, 28 )
local HULL_MIN = Vector( -16, -16, 0 )
local HULL_MAX = Vector( 16, 16, 72 )
local HULL_DUCK_MIN = Vector( -16, -16, 0 )
local HULL_DUCK_MAX = Vector( 16, 16, 36 )
local STEP_SIZE = 18
local PLAYER = FindMetaTable( "Player" )
function PLAYER:SetSize( size )
size = math.Clamp( size, 0.01, 20 ) -- if you don't clamp it at around 20, they will start lagging the server when they walk
self:SetModelScale( size, 0 )
self:SetViewOffset( size * VIEW_OFFSET )
self:SetViewOffsetDucked( size * VIEW_OFFSET_DUCK )
self:SetStepSize( size * STEP_SIZE )
if ( size == 1 ) then
self:ResetHull()
elseif ( size < 1 ) then
self:SetHull( HULL_MIN, size * HULL_MAX )
self:SetHullDuck( HULL_DUCK_MIN, size * HULL_DUCK_MAX )
else
self:SetHull( HULL_MIN, HULL_MAX )
self:SetHullDuck( HULL_DUCK_MIN, HULL_DUCK_MAX )
end
end[/CODE]
Hope this helps.[/QUOTE]
Thanks, I will test this out and see if this fixes the problem I am having. (hopefully I can implement it right and not screw something up, as I am not a coder).
Sorry, you need to Log In to post a reply to this thread.