Get muzzle position

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Get muzzle position

Postby L'In20Cible » Sun Nov 12, 2017 11:28 pm

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.
User avatar
satoon101
Project Leader
Posts: 2725
Joined: Sat Jul 07, 2012 1:59 am

Re: Get muzzle position

Postby satoon101 » Sun Jun 01, 2025 11:39 pm

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.
Image
User avatar
satoon101
Project Leader
Posts: 2725
Joined: Sat Jul 07, 2012 1:59 am

Re: Get muzzle position

Postby satoon101 » Mon Jun 02, 2025 12:11 am

Never mind, using 205 and returning the matrix.position, skipping creating the prop and info_null entities, looks to be working fine!
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 54 guests