attaching a model to an other model

Modelling, Textures, Animating and other general engine asset topics.

attaching a model to an other model

Postby Andriska_hun on Tue Dec 20, 2011 11:46 am

hey, it seems my problem is very custom, because I cannot find any tutorial about it:

I would like to attach an existing model to an existing NPC-model. I know the form of the $attachment qc-command, but I have no idea how can I use it in this case. For example: I have a working weapon and I want to attach it to my npc's left hand. How can I do it?

$attachment ***** "Arm_Left" 0,0,0....etc.

what have I write in the ***** section exactly?
User avatar
Andriska_hun
Member
Member
 
Joined: Fri Feb 12, 2010 4:10 pm

Re: attaching a model to an other model

Postby Gambini on Tue Dec 20, 2011 11:18 pm

A weapon is different than any other case. If you want to attach a model (like a cap, glasses, a helmet) you have to put the model in-game as a prop dynamic and select its parent to the npc name. Then you must add a logic_auto which fires an output to the object like this:

Onmapspawn - setparentattachment -parameteroverrride: "attachment point". You can know the name of the attachment point you want to use by looking at the model with modelviewer.

Weapons are dependent of the game´s core and i´m affraid it requires to code a lot of stuff to make them work (unless you make a model that replaces an existing weapon).

I hope it was helpful.
User avatar
Gambini
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Mon Oct 20, 2008 1:52 am
Location: Buenos Aires, Argentina.

Re: attaching a model to an other model

Postby Andriska_hun on Wed Dec 21, 2011 7:23 am

Thanks for your answer, I'll try it out.

Attaching a simple model: Can I make that I attach an item_key_yellow to Hans Grosse which will be automatically dropped when the player kills him?

Attaching a weapon: what if I clone the existing Chaingun and renaming the included Valve.Biped.Right.Hand joint to Valve.Biped.Left.Hand?
User avatar
Andriska_hun
Member
Member
 
Joined: Fri Feb 12, 2010 4:10 pm

Re: attaching a model to an other model

Postby Gambini on Wed Dec 21, 2011 11:51 pm

i dont have a clue about the second question. But my feeling is that it will be harder than that.

About attaching a key to an npc´s hand it´s the same proccess than the one i described for a helmet but you must know the name of the hand´s attachment point (by looking at the model in the model viewer). For making the npc drop it after dead i´d also attach a teleport destination to this same hand. Then when the npc dies you kill the dynamic key and make another key (this time a phys object) teleport to that destination. There´s also an entity named phys_convert which will convert a prop_dynamic into a prop_physic but i have never used it myself:

https://developer.valvesoftware.com/wiki/Phys_convert
User avatar
Gambini
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Mon Oct 20, 2008 1:52 am
Location: Buenos Aires, Argentina.

Return to Art Creation

Who is online

Users browsing this forum: No registered users