Hello there,
I am trying to do a proper player scale where it changes the size of the player model and how they see ( first person ). I have done the playermodel scale using [URL="http://wiki.garrysmod.com/page/Entity/SetModelScale"]SetModelScale[/URL].
I now wanted to know if it is possible to change the position of where the players looks/see. Because currently their view is where it would appear when the scale is normal. I want it to change to where the eyes of the playermodel are.
Is this possible?
Thanks,
Computer600
CalcView hook
No problem,
HumbleTH
Ok I tried messing around with it and it looks like it works so far but there is one issue. The viewmodels of sweps/weapons are still at the same height where the normal position is. Here's an image of what I mean:
[IMG]http://i.imgur.com/rPycTLS.jpg[/IMG]
How can I move the weapon model lower?
I copied the original CalcView function from the base gamemode and added my change to it and that is the result I'm getting, here's the code:
[CODE]
function calcview( ply, pos, angles, fov )
local Vehicle = ply:GetVehicle()
local Weapon = ply:GetActiveWeapon()
local view = {}
view.origin = origin
view.angles = angles
view.fov = fov
view.znear = znear
view.zfar = zfar
view.drawviewer = false
--
-- Let the vehicle override the view
--
if ( IsValid( Vehicle ) ) then return GAMEMODE:CalcVehicleView( Vehicle, ply, view ) end
--
-- Let drive possibly alter the view
--
if ( drive.CalcView( ply, view ) ) then return view end
--
-- Give the player manager a turn at altering the view
--
player_manager.RunClass( ply, "CalcView", view )
-- My changes
view.origin = pos - Vector( 0, 0, 10 )
-- Give the active weapon a go at changing the viewmodel position
if ( IsValid( Weapon ) ) then
local func = Weapon.CalcView
if ( func ) then
view.origin, view.angles, view.fov = func( Weapon, ply, origin*1, angles*1, fov ) -- Note: *1 to copy the object so the child function can't edit it.
end
end
return view
end
hook.Add("CalcView", "AgeView", calcview )
[/CODE]
EDIT: Found the CalcViewModelView, thanks for your help
Sorry, you need to Log In to post a reply to this thread.