id Tech Forums

id Tech 4 (Doom3/Prey/Q4) => id Tech 4 Models and Animations => Topic started by: bitterman on June 13, 2017, 11:47:00 AM

Title: How to bind weapon to player?
Post by: bitterman on June 13, 2017, 11:47:00 AM
In .def file:

Quote"joint_attach"        "SOUL_ATTACHER"

or PISTOL_, SHOTGUN_ etc.

But "SOUL_ATTACHER" it's not bone's name or joint's name in .md5mesh.

In 'export fred' section of player.def I see:

Quotemesh...
options ... - Rhand SOUL_ATTACHER PISTOL_ATTACHER...

I really don't understand this thing. 'Rhand' is bone's name in player.md5mesh. I don't need to create .mb (maya) and then export it to md5mesh via .def (I already have exported md5mesh).

What is "..._ATTACHER" and how to create this thing when export md5mesh from .blend file or others?

Thanks.
Title: Re: How to bind weapon to player?
Post by: The Happy Friar on June 13, 2017, 12:33:02 PM
Check the weapon's md5mesh.  That could be the one used in the weapon model, not the player.
Title: Re: How to bind weapon to player?
Post by: bitterman on June 14, 2017, 11:22:08 AM
No, it is in player.md5mesh. Sorry, my fault.

No need to deal with 'export' option.
Title: Re: How to bind weapon to player?
Post by: bitterman on September 07, 2017, 11:38:07 AM
Sorry for that, but how to bind an entity to player in editor?

I have only empty room and info_player_start. And seems like k/v "bind" "player1" is not working for me.
Title: Re: How to bind weapon to player?
Post by: The Happy Friar on September 07, 2017, 12:47:22 PM
I thought I did that once but can't find my old .map file.  What I have done in the last several maps I wanted something similar was have a map script that would take the player's coordinates and move a func_mover to those coordinates.  That worked surprisingly well.

I did a test once with a helmet that was either bound to the player or used a script.  It was iffy.  I think I bound it.  I want to say that for any md5mesh that is bound to needs you to specify the entity name AND the bone you bind to.  That would mean it wouldn't be "bind" "player1".  it would be "bind" "player1:head" (if there's a head bone).  Or similar.
Title: Re: How to bind weapon to player?
Post by: bitterman on September 08, 2017, 08:58:23 AM
In level script it can be done this way:

$entity.bind($player1);

But there is a problem - I need that binded entity to always stay in player's view but it's not happend.

When I looking around then entity losts from PVS.

Is it possible to bind entity to player's view (to moving with it)?
Perhaps some bones in player's head are tracking player's view?

Thanks.

Title: Re: How to bind weapon to player?
Post by: The Happy Friar on September 08, 2017, 12:38:38 PM
Anything you can do in the editor you can do in script either directly (like you said in level script) or by setting up entity spawn parameters and spawning that entity with those parameters.

You can always copy the player's location & view angles & apply those to an entity via script.
Title: Re: How to bind weapon to player?
Post by: bitterman on September 08, 2017, 11:21:16 PM
Yes, thanks. Scripts are fine too.

$entity.bintToJoint($player1_head, "Head", true);

Entity will always stay in player's view (depends on distance between player and entity).