# can't change the second decimal on hulls

I was trying to make the SetHullDuck() the same as CS:S and I noticed that you cant change the second decimal ( 0.03… )

I don’t understand why it’s not the same number as CS:S, but it’s not.

If you do “getpos” in console it tells you the exact number.

``````
CS:S - 0.031311
GMOD - 0.031250

``````

Off by 0.000061

I tried changing it by just adding my hull with 0.031311 but it adds it up with 0.031250 now it’s 0.06…

I want to do this so I can add the right CS:S SetHullDuck() in GMOD when crouching in air which is

``````
SetHullDuck( Vector(-16, -16, 0 ), Vector( 16,  16, 55.531296 - 0.031311) )

``````

Even though it says it’s 45 in the CS:S source code:

``````
static CViewVectors g_CSViewVectors(
Vector( 0, 0, 64 ),		// eye position - getpos 64.031311

Vector(-16, -16, 0 ),	// hull min - getpos 0.031311
Vector( 16,  16, 62 ),	// hull max - can't use getpos for this but i'm guessing it's 62.031311

Vector(-16, -16, 0 ),	// duck hull min - getpos 0.031311
Vector( 16,  16, 45 ),	// duck hull max getpos 55.531296
Vector( 0, 0, 47 ),		// duck view getpos 47.031296

);

``````

In air (noclip) with +duck and getpos it’s 55.531296
If it’s not exact you cant get over some blocks in the air and can in CS:S.

Can you post the exact Lua functions you’re running? Your getpos might be off because you’re not at 0,0,0.

I was at 0,0,0. I made a map just for testing this
INTI

``````
function GM:PlayerSpawn(ply)
ply:SetHull(Vector(-16, -16, 0), Vector(16, 16, 62.031311))
ply:SetHullDuck(Vector(-16, -16, 0), Vector(16, 16, 55.531296))
end

``````

CL

``````
local viewset = false

local function HullTimer()
if(LocalPlayer() && LocalPlayer():IsValid() && LocalPlayer().SetHull && LocalPlayer().SetHullDuck) then
if(LocalPlayer().SetViewOffset && LocalPlayer().SetViewOffsetDucked && !viewset) then
LocalPlayer():SetViewOffset(Vector(0, 0, 64.031311))
LocalPlayer():SetViewOffsetDucked(Vector(0, 0, 47.031296))
viewset = true
end
LocalPlayer():SetHull(Vector(-16, -16, 0), Vector(16, 16, 62.031311))
LocalPlayer():SetHullDuck(Vector(-16, -16, 0), Vector(16, 16, 55.531296))
end
end

``````

SHARED

``````
local utr = util.TraceLine
local hduck = Vector(16, 16, 55.531296)
local hstand = Vector(16, 16, 62.031311)
local vduck = Vector(0, 0, 47.031296)
local vstand = Vector(0, 0, 64.031311)

local function FixView(ply)
local tracedata = {}
local maxs = ply:Crouching() and hduck or hstand
local v = ply:Crouching() and vduck or vstand
local offset = ply:Crouching() and ply:GetViewOffsetDucked() or ply:GetViewOffset()
local mins = Vector(-16,-16,0) --will always be this
local s = ply:GetPos()
s.z = s.z + maxs.z
tracedata.start = s
local e = Vector(s.x,s.y,s.z)
e.z = e.z + (12 - maxs.z)
e.z = e.z + v.z
tracedata.endpos = e
tracedata.filter = ply
local trace = utr(tracedata)
if(trace.Fraction < 1) then
local est = s.z + trace.Fraction * (e.z - s.z) - ply:GetPos().z - 12
if(!ply:Crouching()) then
offset.z = est
ply:SetViewOffset(offset)
else
offset.z = math.min(offset.z, est)
ply:SetViewOffsetDucked(offset)
end
else
ply:SetViewOffset(vstand)
ply:SetViewOffsetDucked(vduck)
end
end

``````

Just noticed 47.031296 is different than 0.031311

Here is what I get from standing at the origin in GMod:

``````
] getpos
setpos 0.000000 0.000000 64.000000;setang 0.000000 0.000000 0.000000

``````

Here’s what I get in CS:S:

``````
] getpos
setpos 0.000000 0.000000 64.000061;setang 0.000000 0.000000 0.000000

``````

This “0.031311” offset makes no sense, and isn’t present anywhere in the code.

[editline]3rd March 2017[/editline]

Also, there’s no reason to constantly update the hull in a timer.

Hm that’s werid if you dont setpos to 0 0 0, it is that offset when standing

tldr; the extra .0001 is a rounding error and can be ignored

thats annoying…

[editline]4th March 2017[/editline]

I guess I can’t make a exact CS:S pos than.

You can, but it would require rewriting the entire movement base.

I don’t think it’s a rounding error because on Fortress Forever its 0.072311

[editline]6th March 2017[/editline]

where even this this in the source code

If you’re going to rate my post Dumb, then I’d really appreciate if you’d post why.