PDA

View Full Version : World Model (Weapons)


Marine
05-18-2007, 01:06 PM
Hey,

I was just wondering if anyone knew how to get the Counter-Strike weapons to sit correctly in the persons hands in HL2: MP


I know its something to do with the player bones, but at the moment im lookin through a lot of files to try and find where...

I would need it to be set by a flag in the weapon_****.txt script file, like Ironsights :P

TG™
05-18-2007, 06:18 PM
Hmm are you sure you haven't edited more code? My mod run's perfectly fine with css's weapons tho i've got all the content mounted within the code. Might have an effect. I don't know :)

NokiaTokia
05-18-2007, 09:19 PM
Hey,

I was just wondering if anyone knew how to get the Counter-Strike weapons to sit correctly in the persons hands in HL2: MP


I know its something to do with the player bones, but at the moment im lookin through a lot of files to try and find where...

I would need it to be set by a flag in the weapon_****.txt script file, like Ironsights :P


I believe your refereing to viewmodel_fov cvar delcared in view.cpp, HL2 MP uses 54 and Cs:s strike use 75. If this is the case, then you would have to replace the cvar with a variabled declared in the current weapons parse data, CHL2MPSWeaponInfo, that would be obtained through weapon_xxx.txt.

TG™
05-19-2007, 04:31 AM
I believe your refereing to viewmodel_fov cvar delcared in view.cpp, HL2 MP uses 54 and Cs:s strike use 75. If this is the case, then you would have to replace the cvar with a variabled declared in the current weapons parse data, CHL2MPSWeaponInfo, that would be obtained through weapon_xxx.txt.

No he's not. He's talking about the world weapons been positioned wrong on the player, i.e the gun been placed in the abdomen and not the hands.

lodle
05-19-2007, 05:52 AM
Its set in to places, in code


{
{ ACT_HL2MP_IDLE, ACT_HL2MP_IDLE_PISTOL, false },
{ ACT_HL2MP_RUN, ACT_HL2MP_RUN_PISTOL, false },
{ ACT_HL2MP_IDLE_CROUCH, ACT_HL2MP_IDLE_CROUCH_PISTOL, false },
{ ACT_HL2MP_WALK_CROUCH, ACT_HL2MP_WALK_CROUCH_PISTOL, false },
{ ACT_HL2MP_GESTURE_RANGE_ATTACK, ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, false },
{ ACT_HL2MP_GESTURE_RELOAD, ACT_HL2MP_GESTURE_RELOAD_PISTOL, false },
{ ACT_HL2MP_JUMP, ACT_HL2MP_JUMP_PISTOL, false },
{ ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_PISTOL, false },
};


and in the player modle file qc.

Marine
05-19-2007, 09:36 AM
Aah, so its not down to the fact that the bones are named differently? I tried finding the anim_attachment_rh and putting in some more code for it, so if it found none, it would look for the cs:s ones, but obviously it didnt work for some reason :(.

Ging
05-22-2007, 05:50 AM
World models use bone merging to dictate how they link to player models (you can see this by doing RemoveEffects(EF_BONEMERGE) in a weapons DrawModel function). I believe CSS weapons merge to ValveBiped.Bip01_R_Hand by default, but don't quote me on that.

Marine
05-22-2007, 01:06 PM
World models use bone merging to dictate how they link to player models (you can see this by doing RemoveEffects(EF_BONEMERGE) in a weapons DrawModel function). I believe CSS weapons merge to ValveBiped.Bip01_R_Hand by default, but don't quote me on that.

I had a look in AddEntity (C_BasePlayer)

It looks for "anim_attachment_rh", which if i look in the Model Viewer is Linked to a bone in the hand. I tried using GetBone / LookupBone instead (And used the full ValveBiped.Bip01_R_Hand), but whether i am in the right place or not, or whether the functions are called right is another matter.

Edit: Am i being totally dumb or what? It would be in the weapon draw functions would it not?

Marine
05-24-2007, 06:00 AM
World models use bone merging to dictate how they link to player models (you can see this by doing RemoveEffects(EF_BONEMERGE) in a weapons DrawModel function). I believe CSS weapons merge to ValveBiped.Bip01_R_Hand by default, but don't quote me on that.

I tried searching my whole solution for ValveBiped.Bip01_R_Hand, couldn't find a thing.

Is this something that is likely to be in the model qc file? If so it will mean decompiling models :(

Ging
05-24-2007, 10:02 AM
Yeah, it's specified as an attachment in the weapon world models.

StuD-tos
05-29-2007, 11:31 AM
The only way I have yet been told to fix this issue, is by reboning the weapon models to use the correct attachment bone ValveBiped.Bip01_RH. I am wondering if anyone has come up with a way to do this through code without having to rebone weapons?

Marine
05-29-2007, 12:48 PM
StuD, i believe Garry Newman (Garry's Mod) did it, but he never replies when i ask him... Maybe go pester him :P

StuD-tos
05-31-2007, 04:58 AM
I am actually using custom CSS models with custom CSS weapons. In the model viewer they are attaching correctly but in game they float below the feet. So for me it is not a bone issue with the models, it is a code issue.

Marine
05-31-2007, 07:20 AM
I am actually using custom CSS models with custom CSS weapons. In the model viewer they are attaching correctly but in game they float below the feet. So for me it is not a bone issue with the models, it is a code issue.


That is because of animation issues, you have to change all the Animations in your code, and it should work...

However, im still stumped, maybe we could get a guy from valve to poiunt us onto the right track :D

StuD-tos
05-31-2007, 07:22 AM
I don't believe it is related to animations, animations would cause the guy to walk like a cross and i recompiled player models using hl2dm animations.

Marine
05-31-2007, 07:29 AM
I don't believe it is related to animations, animations would cause the guy to walk like a cross and i recompiled player models using hl2dm animations.

With the correct bone structure / attachment? :P

StuD-tos
05-31-2007, 08:51 AM
Not sure, animations is my weakest spot in coding. Check your PM.

Wanted Mod
05-31-2007, 04:06 PM
Hey,

I was just wondering if anyone knew how to get the Counter-Strike weapons to sit correctly in the persons hands in HL2: MP


I know its something to do with the player bones, but at the moment im lookin through a lot of files to try and find where...

I would need it to be set by a flag in the weapon_****.txt script file, like Ironsights :P

Checkout http://developer.valvesoftware.com/wiki/Importing_CSS_Weapons_Into_HL2

Marine
05-31-2007, 04:36 PM
Checkout http://developer.valvesoftware.com/wiki/Importing_CSS_Weapons_Into_HL2

Yeh, but still involves world model editing. I am sure it is possible in code...

lodle
06-01-2007, 02:49 AM
nope its all to do with the qc file for the player model, the code only tells the game which one to use but they still have to exist in the model.

jmdrummer16
06-01-2007, 10:19 AM
this has everything to do with animations, fix it all in sdk_playeranimstate.cpp

StuD-tos
06-01-2007, 10:29 PM
jmdrummer16, could to post an example maybe? Would this be base_playeranimstate in a hl2mp mod?

Marine
06-02-2007, 06:17 AM
It's simple really, i thought it over last night...

All you gotta do is move the ValveBiped of the model to the anim_attachment_RH

But i cant test it because i dont know where the world model is drawn...

Anyone know? :P

For the moment, at least i got the hacked models working :P

http://img507.imageshack.us/img507/622/dedust20008qm9.jpg

SteveUK
06-03-2007, 03:28 PM
I think hackig models is the only way of going about it, Garry Newman (Garry's Mod) said that in Gmod 10 he used models fixes to get the attachment to work properly.

Marine
06-03-2007, 03:56 PM
Yeh, i think so too -- you wont guess where i got those weapon models from ;-) :P:P:P

StuD-tos
06-24-2007, 05:23 AM
Ever try changing the anim_prefix in the weapon_script.txt to something CSS uses??

"anim_prefix" "pistol"
"anim_prefix" "shotgun"
"anim_prefix" "ump45"
"anim_prefix" "mp5"
"anim_prefix" "m4"
"anim_prefix" "ak"

Marine
06-24-2007, 06:37 AM
Yeah tried that.