id Tech Forums

id Tech 4 (Doom3/Prey/Q4) => id Tech 4 Models and Animations => Topic started by: bitterman on April 02, 2018, 08:44:35 AM

Title: How to oriented bone to spawn other model in expected direction when attached
Post by: bitterman on April 02, 2018, 08:44:35 AM
E.g. I have a skeleton with "pistol_attacher" bone and pistol model with "joint_attach" "pistol_attacher" in .def.

Is will be "origin" bone of pistol oriented same as "pistol_attacher" in skeleton?

Or, in other words, will the "origin" have same values of loc/rot/scale as "attacher"?

Thanks.
Title: Re: How to oriented bone to spawn other model in expected direction when attached
Post by: bitterman on April 03, 2018, 10:28:54 AM
Looks like weapon model oriented along Y+.

Is it from Maya by default?

Not sure about rotation. And don't see any decls to change loc/rot of attached entity.

/*
================
idWeapon::InitWorldModel
================
*/
void idWeapon::InitWorldModel( const idDeclEntityDef *def ) {
idEntity *ent;

ent = worldModel.GetEntity();

assert( ent );
assert( def );

const char *model = def->dict.GetString( "model_world" );
const char *attach = def->dict.GetString( "joint_attach" );

ent->SetSkin( NULL );
if ( model[0] && attach[0] ) {
ent->Show();
ent->SetModel( model );
if ( ent->GetAnimator()->ModelDef() ) {
ent->SetSkin( ent->GetAnimator()->ModelDef()->GetDefaultSkin() );
}
ent->GetPhysics()->SetContents( 0 );
ent->GetPhysics()->SetClipModel( NULL, 1.0f );
ent->BindToJoint( owner, attach, true );
ent->GetPhysics()->SetOrigin( vec3_origin );
ent->GetPhysics()->SetAxis( mat3_identity );


Title: Re: How to oriented bone to spawn other model in expected direction when attached
Post by: bitterman on April 04, 2018, 12:57:03 PM
Some related info (not for weapons):

http://wiki.thedarkmod.com/index.php?title=Attachment_Positions (http://wiki.thedarkmod.com/index.php?title=Attachment_Positions)

Still don't understand how to correctly place attacher's bones in the initial modeling.

Customizing in the process?

Why they set this distance between the bone "origin" and the handle of the gun?
Title: Re: How to oriented bone to spawn other model in expected direction when attached
Post by: The Happy Friar on April 07, 2018, 07:53:42 PM
Last time I did 3rd person weapon models I followed the same bone origin as D3 did.  I noticed that if I didn't do that the weapon didn't appear properly so it was more of a "meh."  :)
Title: Re: How to oriented bone to spawn other model in expected direction when attached
Post by: bitterman on April 18, 2018, 11:41:52 AM
Don't even smile - it's just a prototype.
Title: Re: How to oriented bone to spawn other model in expected direction when attached
Post by: The Happy Friar on April 22, 2018, 05:03:23 PM
bone structure is the most important part, once that's done everything else is just verts bound to the bones.
Good job.  :)