Page 2 of 2

Re: Get muzzle position

Posted: Sun Nov 12, 2017 11:28 pm
by L'In20Cible
satoon101 wrote:lol. Hey, as long as it works, I'm good with it. Thank you!
It might have a direct way to retrieve the origin by extracting the animation/pose parameter from the cs_player_shared.mdl/ak_anims_t/ct.mdl files but I'm really unsure about that. The bone might also be different for CS:GO, I extracted it from CCSPlayer::CSWeaponDrop (this is where the engine position the weapon when dropped):
Image
Ayuto wrote:No need to use a signature for LookupBone:

Are they matching? When I tested yesterday, indexes were different. Assumed the bone was from an $includemodel or something. But now that you mention it, and that I did the lookup in place, I think I forgot to break the loop resulting in the index to be the last in range instead of the match. :embarrassed:

EDIT: Yes it does! Updated the code.

Re: Get muzzle position

Posted: Sun Jun 01, 2025 11:39 pm
by satoon101
Sorry to necro an old thread, but I am not sure that the code is working properly. I honestly don't know how well I tested it back in 2017, so it could have been broken this whole time or it could have been broken by Valve in an update or something. But, when I print out the shooter's origin and compare it to the value of get_muzzle_position, they just can't be correct:

Code: Select all

Muzzle Position: Vector(13.0791015625, 1175.8717041015625, -1039.053466796875)
Player Origin: Vector(592.8280029296875, 1128.02734375, 0.03125)

The offset definitely changed, so perhaps that's it. I did find a couple offsets nearby 199 that didn't give me RuntimeErrors and returned an actual Vector other than 0,0,0, but neither seems to be close to the correct position, unfortunately.

Re: Get muzzle position

Posted: Mon Jun 02, 2025 12:11 am
by satoon101
Never mind, using 205 and returning the matrix.position, skipping creating the prop and info_null entities, looks to be working fine!