• Player view / weapon position scaling
    1 replies, posted
Does anyone have some example code I could look at to change the players view and aimpoint to match the scale of the player? I would like to scale player models down, and have it feel like you are that small as the player, right now only the model size changes.
I'm actually really curious if someone has a dynamic system for doing this, because for the longest time I've had mismatching hitboxes and model sizes. I'm currently doing the following: [CODE] local NORMAL_VIEWOFFSET = Vector(0, 0, 64) local NORMAL_VIEWOFFSET_DUCK = Vector(0, 0, 28) local NORMAL_HULL_MIN = Vector(-16, -16, 0) local NORMAL_HULL_MAX = Vector( 16, 16, 72) local NORMAL_HULL_DUCK_MIN = Vector(-16, -16, 0) local NORMAL_HULL_DUCK_MAX = Vector( 16, 16, 36) ply:SetModelScale( size, 0 ) ply:SetViewOffset( NORMAL_VIEWOFFSET * size ) ply:SetViewOffsetDucked( NORMAL_VIEWOFFSET_DUCK * size ) local clampedSize = math.Clamp( size, 0.05, 1 ) ply:SetHull( NORMAL_HULL_MIN * clampedSize, NORMAL_HULL_MAX * clampedSize ) ply:SetHullDuck( NORMAL_HULL_DUCK_MIN * clampedSize, NORMAL_HULL_DUCK_MAX * clampedSize ) [/CODE] I wrote it so long ago and haven't bothered to try and come up with a better solution. The constants I declared are fudged and I didn't really know what I was doing at the time. It gets the job done in terms of adjusting the player's view to their model size, but the hitboxes are a bit off, usually smaller than the player's model when the size is less than 1. I think I clamped the size because when players set their sizes up to 10-20+, they were starting to clip into other players and get stuck a lot (they are really big in this range, and it was just a fun command, no real practical use). If no one has any better suggestions, I guess you could at least try to mess around with SetViewOffset and SetViewOffsetDucked. [B]EDIT:[/B] Wow, I actually typo'd and put ply:SetHullDick. GG.
Sorry, you need to Log In to post a reply to this thread.