Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetCollisionBounds( ) returns different values for weapons client/serverside #223

Open
Acecool opened this issue Jul 3, 2013 · 1 comment
Labels
Bug The issue is confirmed to be a bug and not intentional behaviour.

Comments

@Acecool
Copy link

Acecool commented Jul 3, 2013

I designed a system that makes a user look at a weapon on the ground and tap use to pick it up, or hold use to swap if they already have that class of weapon in their possession. I noticed that that sometimes I would have errors on the client-side where it wouldn't show the text on the screen, and other times the text on the screen would follow the client even when not looking at a weapon. Additionally I noticed that sometimes while looking at a weapon and trying to pick it up, the client would report that I should have picked up the weapon but I'd end up with a different weapon in my possession.

I narrowed it down to GetCollisionBounds not reporting identical values client and server-side.

Here's a 10 minute video on the subject: http://www.twitch.tv/acecoolco/b/425434019
Go to the 8:25 mark if you want to see weapons spawning with this code in init on client vs server:

Remember, I recoded print so it prints nice vectors out and handles different data types for ease in debugging.

First line on client/server is GetCollisionBounds min, the next line is max. The third line is trying the same with OBBMins, fourth with maxs, fifth with mids.

The last 3 lines can be disregarded because they report the same as GetCollisionBounds. My computer locked up due to the video encoding, if you like I can do another video with just two lines per weapon and output the weapon on the server/client with all the CSS weapons.

One of the addons I have, assault weapons pack by M9K, has a weapon that reports "normal" values on the client, but on the server it reports something along the lines of 0-6000, 0-3000, 0-11000 which is quite a ways off. The bounds that appear to be used are not the client-bounds, but the server bounds, including when using a trace.Entity to see if you're looking at it client-side.

    local min, max = self.Weapon:GetCollisionBounds()
    local mins = self.Weapon:OBBMins(); 
    local maxs = self.Weapon:OBBMaxs();
    local mids = self.Weapon:OBBMaxs();

    print( min ); 
    print( max );   
    print( mins ); 
    print( maxs );
    print( mids );
@Acecool
Copy link
Author

Acecool commented Jul 6, 2013

Quick update; I output an entire array of information on the client side ( I did this because the server was outputting radical information; seemingly way out of range; but this method has no effect in correcting the collision bounds it seems or the Trace.Entity bounding box. )

So if the array exists with the weapon type, it loads it but it doesn't appear to have any effects on the weapons with the overly ridiculous sizes.. I tried self:SetCollisionBounds as well.

toprint is the internal function which works with my print function to return nicely formatted data.

This is on SWEP:Initialize, shared.

    if ( self.CollisionBounds[ self.Weapon:GetClass( ) ] ) then
        local _cb = self.CollisionBounds[ self.Weapon:GetClass( ) ];
        self.Weapon:SetCollisionBounds( _cb.min, _cb.max );
    else
        local min, max = self.Weapon:GetCollisionBounds()
        print( "SWEP.CollisionBounds[\"" .. self.Weapon:GetClass( ) .. "\"] = { min = " .. toprint( min ) .. ", max = " .. toprint( max ) .. " };" )
    end
SWEP.CollisionBounds = { };
SWEP.CollisionBounds["admin_stick"] = { min = Vector( 7.42, -16.43, -29.43 ), max = Vector( 37.86, 0, -0.41 ) };
SWEP.CollisionBounds["weapon_m9k_hk_sl8"] = { min = Vector( -9.44, -10.55, -18.25 ), max = Vector( 29.17, 10.52, 0.96 ) };
SWEP.CollisionBounds["weapon_m9k_hk_416"] = { min = Vector( -6.54, -6.9, -10.01 ), max = Vector( 27.1, 5.57, 0.05 ) };
SWEP.CollisionBounds["weapon_m9k_taurus_raging_bull"] = { min = Vector( -8.8, -5.92, -11.38 ), max = Vector( 13.05, 7.41, 0.38 ) };
SWEP.CollisionBounds["weapon_m9k_imi_uzi"] = { min = Vector( -7.62, -13.83, -22.13 ), max = Vector( 21.56, 10.32, 2.19 ) };
SWEP.CollisionBounds["weapon_css_imi_deserteagle"] = { min = Vector( -6.89, -2.51, -13.53 ), max = Vector( 18.82, 9.18, -2.71 ) };
SWEP.CollisionBounds["weapon_m9k_imi_tavor"] = { min = Vector( -11.04, -8.13, -10.18 ), max = Vector( 15.81, 13.83, 0 ) };
SWEP.CollisionBounds["weapon_m9k_imi_deserteagle"] = { min = Vector( -9.71, -6.82, -10.11 ), max = Vector( 15.94, 6.2, -0.27 ) };
SWEP.CollisionBounds["weapon_m9k_amd_65"] = { min = Vector( -12.54, -14.16, -12.77 ), max = Vector( 27.28, 7.16, -0.64 ) };
SWEP.CollisionBounds["weapon_m9k_winchester_1887"] = { min = Vector( -10.82, -6.73, -10.23 ), max = Vector( 33.01, 8.43, 0.86 ) };
SWEP.CollisionBounds["weapon_unknown_beretta_m92"] = { min = Vector( -7.41, -9.04, -13.4 ), max = Vector( 17.54, 8.84, -1.2 ) };
SWEP.CollisionBounds["weapon_m9k_fn_fal"] = { min = Vector( -6.36, -11.5, -11.24 ), max = Vector( 34.11, 11.84, -0.02 ) };
SWEP.CollisionBounds["weapon_m9k_m1918_bar"] = { min = Vector( -11.82, -12.04, -15.96 ), max = Vector( 36.06, 14.08, -1.01 ) };
SWEP.CollisionBounds["weapon_m9k_magpul_pdr"] = { min = Vector( -6.83, -3.65, -13.03 ), max = Vector( 18.93, 12.81, -2.01 ) };
SWEP.CollisionBounds["weapon_m9k_hk_usp"] = { min = Vector( -10.3, -7.52, -8.74 ), max = Vector( 15.08, 3.71, -0.24 ) };
SWEP.CollisionBounds["weapon_m9k_fn_p90"] = { min = Vector( -8.94, -6.08, -13.82 ), max = Vector( 18.08, 6.79, 0.45 ) };
SWEP.CollisionBounds["weapon_css_sig_p228"] = { min = Vector( -7.09, -2.91, -13.23 ), max = Vector( 16.37, 8.78, 0 ) };
SWEP.CollisionBounds["weapon_m9k_intervention"] = { min = Vector( -6.33, -6.44, -8.49 ), max = Vector( 41.42, 9.26, 1.05 ) };
SWEP.CollisionBounds["weapon_m9k_colt_1911"] = { min = Vector( -10.3, -7.52, -8.74 ), max = Vector( 14.87, 3.71, -0.24 ) };
SWEP.CollisionBounds["weapon_m9k_tec9"] = { min = Vector( -12.08, -7.34, -10.49 ), max = Vector( 20.3, 6.35, -2.18 ) };
SWEP.CollisionBounds["weapon_m9k_svd_dragunov"] = { min = Vector( -5.53, -10.85, -11.91 ), max = Vector( 37.73, 4.99, 1.26 ) };
SWEP.CollisionBounds["weapon_m9k_m134_minigun"] = { min = Vector( -4.38, -9.87, -14.22 ), max = Vector( 32.48, 6.58, -2.37 ) };
SWEP.CollisionBounds["weapon_css_hk_mp5"] = { min = Vector( -9.59, -3.3, -12.88 ), max = Vector( 20.83, 8.93, -1.89 ) };
SWEP.CollisionBounds["weapon_css_glock_18"] = { min = Vector( -7.19, -3.31, -13.33 ), max = Vector( 16.87, 8.28, -1.54 ) };
SWEP.CollisionBounds["weapon_m9k_bizon_pp19"] = { min = Vector( -11.35, -13.94, -11.69 ), max = Vector( 21.76, 9.49, -0.98 ) };
SWEP.CollisionBounds["weapon_m9k_usas"] = { min = Vector( -9.09, -6.47, -12.41 ), max = Vector( 30.51, 7.07, -0.49 ) };
SWEP.CollisionBounds["weapon_m9k_remington_7615p"] = { min = Vector( -8.61, -179.72, -189.92 ), max = Vector( 10027.22, 186.26, 175.29 ) };
SWEP.CollisionBounds["weapon_m9k_winchester_1897"] = { min = Vector( -9.93, -13.43, -11.06 ), max = Vector( 24.95, 14.19, -0.02 ) };
SWEP.CollisionBounds["weapon_m9k_unknown_mp9"] = { min = Vector( -8.64, -6.94, -12.61 ), max = Vector( 22.78, 11.94, 0.76 ) };
SWEP.CollisionBounds["weapon_m9k_unknown_m29_satan"] = { min = Vector( -6.43, -9.47, -8.93 ), max = Vector( 19.65, 3.11, -0.08 ) };
SWEP.CollisionBounds["weapon_m9k_unknown_l85"] = { min = Vector( -5.12, -12.64, -11.46 ), max = Vector( 23.78, 10.23, 0.29 ) };
SWEP.CollisionBounds["weapon_m9k_ai_aw50"] = { min = Vector( -12.5, -5.45, -13.45 ), max = Vector( 41.26, 12.41, 0.31 ) };
SWEP.CollisionBounds["weapon_m9k_unknown_acr"] = { min = Vector( -6.91, -5.17, -28.59 ), max = Vector( 31.6, 10.51, 0.34 ) };
SWEP.CollisionBounds["weapon_m9k_tommy_gun"] = { min = Vector( -8.88, -9.32, -14.39 ), max = Vector( 27.27, 10.07, -1 ) };
SWEP.CollisionBounds["weapon_m9k_melee_machete"] = { min = Vector( 6.17, -7.74, -18.65 ), max = Vector( 22.78, 11.67, 3.37 ) };
SWEP.CollisionBounds["weapon_m9k_taurus_raging_bull_s"] = { min = Vector( -8.79, -5.92, -11.38 ), max = Vector( 13.46, 7.41, 0.64 ) };
SWEP.CollisionBounds["weapon_m9k_sw_model_627"] = { min = Vector( -11.07, -12.14, -12.29 ), max = Vector( 15.37, 6.07, -1.44 ) };
SWEP.CollisionBounds["weapon_css_colt_m4a1"] = { min = Vector( -9.97, -1.88, -12.79 ), max = Vector( 29.05, 9.87, 0 ) };
SWEP.CollisionBounds["weapon_m9k_m24"] = { min = Vector( -9.59, -11.51, -11 ), max = Vector( 30.14, 10.74, -0.61 ) };
SWEP.CollisionBounds["weapon_m9k_sw_model_3_russian"] = { min = Vector( -7.42, -1.93, -13.21 ), max = Vector( 21.98, 8.41, 38.59 ) };
SWEP.CollisionBounds["weapon_css_fn_p90"] = { min = Vector( -7.29, -2.71, -12.8 ), max = Vector( 18.89, 8.78, -1.77 ) };
SWEP.CollisionBounds["weapon_m9k_svt_40"] = { min = Vector( -9.06, -13.75, -11.15 ), max = Vector( 35.71, 4.19, 0.74 ) };
SWEP.CollisionBounds["weapon_css_imi_galil"] = { min = Vector( -5.72, -7.83, -14.09 ), max = Vector( 35.93, 3.41, 0 ) };
SWEP.CollisionBounds["weapon_m9k_sig_p229r"] = { min = Vector( -7.35, -5.03, -10.75 ), max = Vector( 17.84, 6.4, -0.85 ) };
SWEP.CollisionBounds["weapon_m9k_remington_870"] = { min = Vector( -16.07, -9.22, -11.77 ), max = Vector( 27.28, 8.62, -1.06 ) };
SWEP.CollisionBounds["weapon_css_hk_usp"] = { min = Vector( -6.59, -3.07, -13.55 ), max = Vector( 23.12, 8.68, -2.68 ) };
SWEP.CollisionBounds["weapon_m9k_remington_1858"] = { min = Vector( -9.45, -3.57, -15.29 ), max = Vector( 22.87, 9.79, -1.45 ) };
SWEP.CollisionBounds["weapon_css_hk_ump"] = { min = Vector( -6.59, -0.71, -14.55 ), max = Vector( 26.37, 10.78, -2.45 ) };
SWEP.CollisionBounds["weapon_m9k_mossberg_590"] = { min = Vector( -13.81, -11.14, -16.52 ), max = Vector( 30.13, 11.8, 7.56 ) };
SWEP.CollisionBounds["weapon_m9k_fg_42"] = { min = Vector( -2.86, -12.76, -11.82 ), max = Vector( 35.79, 7.44, 0.01 ) };
SWEP.CollisionBounds["weapon_m9k_melee_damascus"] = { min = Vector( -9.62, -16.35, -21.99 ), max = Vector( 48.8, 8.64, 21.65 ) };
SWEP.CollisionBounds["weapon_css_mac_10"] = { min = Vector( -3.49, -4.75, -13.45 ), max = Vector( 19.02, 9.56, -0.1 ) };
SWEP.CollisionBounds["weapon_m9k_hk_ump"] = { min = Vector( -5.79, -4.01, -11.86 ), max = Vector( 22.38, 10.96, -0.9 ) };
SWEP.CollisionBounds["weapon_m9k_mas_famas"] = { min = Vector( -12.33, -9.51, -15.3 ), max = Vector( 28.1, 16.98, 1.9 ) };
SWEP.CollisionBounds["weapon_m9k_sw_model_500"] = { min = Vector( -9.31, -6.86, -9.42 ), max = Vector( 19.2, 6.61, -0.35 ) };
SWEP.CollisionBounds["weapon_m9k_luger_p08"] = { min = Vector( -7.64, -6.84, -25.01 ), max = Vector( 17.85, 12.48, 0.54 ) };
SWEP.CollisionBounds["weapon_m9k_kriss_vector"] = { min = Vector( -11.25, -3.92, -13.82 ), max = Vector( 19.88, 14.11, -0.81 ) };
SWEP.CollisionBounds["weapon_m9k_kac_pdw"] = { min = Vector( -9.81, -6.1, -15.28 ), max = Vector( 33.49, 12.1, -0.29 ) };
SWEP.CollisionBounds["weapon_m9k_hk_usc"] = { min = Vector( -6.59, -3.21, -14.54 ), max = Vector( 33.14, 8.27, -1.41 ) };
SWEP.CollisionBounds["weapon_m9k_benelli_m3s90"] = { min = Vector( -7.97, -13.93, -10.38 ), max = Vector( 31.79, 9.72, -1.1 ) };
SWEP.CollisionBounds["weapon_m9k_barret_m82"] = { min = Vector( -3.91, -12.25, -13.9 ), max = Vector( 46.06, 14.77, -0.78 ) };
SWEP.CollisionBounds["weapon_m9k_colt_m4a1"] = { min = Vector( -16.09, -14.24, -21.54 ), max = Vector( 30.67, 4.88, 11.44 ) };
SWEP.CollisionBounds["weapon_m9k_steyr_aug_a3"] = { min = Vector( -5.41, -4.13, -9.93 ), max = Vector( 22.99, 9.25, 2.27 ) };
SWEP.CollisionBounds["weapon_m9k_hk_mp5"] = { min = Vector( -7.18, -6.83, -28.59 ), max = Vector( 19.26, 10.39, -0.67 ) };
SWEP.CollisionBounds["weapon_m9k_hk_g36"] = { min = Vector( -5.93, -7.22, -28.59 ), max = Vector( 26.99, 11.73, -0.75 ) };
SWEP.CollisionBounds["weapon_m9k_as_val"] = { min = Vector( -16.98, -7.18, -13.71 ), max = Vector( 24.74, 13.58, 0.3 ) };
SWEP.CollisionBounds["weapon_css_hl2_mp7"] = { min = Vector( -1.83, -7.95, -31.89 ), max = Vector( 34.18, 3.76, -0.58 ) };
SWEP.CollisionBounds["weapon_m9k_hk_mp5_sd"] = { min = Vector( -11.64, -7.87, -12.39 ), max = Vector( 21.78, 9.24, -1.01 ) };
SWEP.CollisionBounds["weapon_m9k_glock_17"] = { min = Vector( -21.5, -8.71, -18.42 ), max = Vector( 15.74, 5.61, 1.37 ) };
SWEP.CollisionBounds["weapon_m9k_fn_m249"] = { min = Vector( -2.54, -12.44, -13.09 ), max = Vector( 29.23, 11.35, -0.04 ) };
SWEP.CollisionBounds["weapon_csgo_taser"] = { min = Vector( -7.55, -37.84, 0 ), max = Vector( 9.64, 44.75, 67.78 ) };
SWEP.CollisionBounds["weapon_m9k_fn_f2000"] = { min = Vector( -13.11, -6.64, -14.57 ), max = Vector( 26.67, 13.36, -0.23 ) };
SWEP.CollisionBounds["weapon_m9k_dragunov_svu"] = { min = Vector( -4.98, -9.46, -13.98 ), max = Vector( 32.14, 4.67, 0.39 ) };
SWEP.CollisionBounds["weapon_m9k_colt_python"] = { min = Vector( -6.82, -8.11, -9.55 ), max = Vector( 21.46, 4.91, 3.88 ) };
SWEP.CollisionBounds["weapon_m9k_browning_auto_5"] = { min = Vector( -10.49, -14.35, -10.85 ), max = Vector( 33.87, 9.03, 3.05 ) };
SWEP.CollisionBounds["weapon_m9k_barret_m98b"] = { min = Vector( -9.19, -9.94, -19.91 ), max = Vector( 37.08, 8.28, 5.96 ) };
SWEP.CollisionBounds["weapon_m9k_hk_45"] = { min = Vector( -6.23, -7.03, -11.73 ), max = Vector( 17.73, 5.1, -0.81 ) };
SWEP.CollisionBounds["weapon_m9k_ak47"] = { min = Vector( -8.6, -2.76, -12.84 ), max = Vector( 31.47, 9.31, -1.35 ) };
SWEP.CollisionBounds["weapon_css_glock_17"] = { min = Vector( -7.19, -3.31, -13.33 ), max = Vector( 16.87, 8.28, -1.54 ) };
SWEP.CollisionBounds["weapon_css_knife"] = { min = Vector( -1.09, -15.98, -14.64 ), max = Vector( 17.93, 10.63, 4.89 ) };
SWEP.CollisionBounds["weapon_m9k_m60"] = { min = Vector( -11.8, -18.75, -15.32 ), max = Vector( 35.79, 6.93, -2.16 ) };
SWEP.CollisionBounds["weapon_css_steyr_tmp"] = { min = Vector( -6.29, -3.4, -11.53 ), max = Vector( 26.53, 9.08, -1.99 ) };
SWEP.CollisionBounds["weapon_css_fn_fiveseven"] = { min = Vector( -7.09, -3.69, -15.06 ), max = Vector( 17.05, 8.38, -3.24 ) };
SWEP.CollisionBounds["weapon_css_ak47"] = { min = Vector( -8.64, -2.27, -12.71 ), max = Vector( 29.84, 10.01, 0 ) };
SWEP.CollisionBounds["weapon_css_steyr_scout"] = { min = Vector( -11.49, -3.34, -10.71 ), max = Vector( 26.96, 11.64, -1.91 ) };
SWEP.CollisionBounds["weapon_m9k_spas_12"] = { min = Vector( -13.33, -4.35, -13.02 ), max = Vector( 22.46, 10.22, -1.56 ) };
SWEP.CollisionBounds["weapon_css_sig_sg552"] = { min = Vector( -6.44, -1.54, -14.01 ), max = Vector( 29.93, 10.78, -1.81 ) };
SWEP.CollisionBounds["weapon_css_mas_famas"] = { min = Vector( -5.18, -9.34, -14.08 ), max = Vector( 22.98, 6.3, -0.35 ) };
SWEP.CollisionBounds["weapon_css_steyr_aug"] = { min = Vector( -8.39, -2.41, -14.49 ), max = Vector( 24.69, 11.09, -1.06 ) };
SWEP.CollisionBounds["weapon_m9k_thompson_contender"] = { min = Vector( -8.56, -7.91, -10.54 ), max = Vector( 20.88, 4.46, 0.4 ) };
SWEP.CollisionBounds["weapon_m9k_striker_12"] = { min = Vector( -30.73, -10.66, -14.72 ), max = Vector( 22.65, 8.64, 6.74 ) };
SWEP.CollisionBounds["weapon_m9k_unknown_sten"] = { min = Vector( -9.61, -7.83, -15.72 ), max = Vector( 27.04, 7.81, 2.77 ) };
SWEP.CollisionBounds["weapon_m9k_hk_psg1"] = { min = Vector( -5.27, -4.02, -14.34 ), max = Vector( 40.28, 13.37, 0.09 ) };
SWEP.CollisionBounds["weapon_m9k_hk_mp7"] = { min = Vector( -8.58, -6.44, -10.18 ), max = Vector( 25.35, 6.08, -0.07 ) };
SWEP.CollisionBounds["weapon_m9k_fn_scar"] = { min = Vector( -6.74, -10.05, -11.34 ), max = Vector( 24.46, 7.26, 0.29 ) };
SWEP.CollisionBounds["weapon_m9k_ithaca_m37"] = { min = Vector( -5.46, -7.38, -18.64 ), max = Vector( 25.02, 13.12, 0 ) };
SWEP.CollisionBounds["weapon_m9k_glock_18"] = { min = Vector( -21.5, -8.71, -18.42 ), max = Vector( 15.74, 5.61, 1.37 ) };
SWEP.CollisionBounds["weapon_m9k_pancor_jackhammer"] = { min = Vector( -8.4, -7.34, -17.92 ), max = Vector( 26.44, 11.26, 6.01 ) };
SWEP.CollisionBounds["weapon_css_fn_m249"] = { min = Vector( -7.91, -7.22, -14.75 ), max = Vector( 29.05, 4.74, 0 ) };
SWEP.CollisionBounds["weapon_m9k_ares_shrike"] = { min = Vector( -9.62, -6.73, -12.6 ), max = Vector( 21.48, 10.59, -0.28 ) };
SWEP.CollisionBounds["weapon_m9k_hk_g3"] = { min = Vector( -31.41, -4.47, -10.04 ), max = Vector( 31.19, 12.09, -1 ) };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The issue is confirmed to be a bug and not intentional behaviour.
Projects
None yet
Development

No branches or pull requests

1 participant