How to oriented bone to spawn other model in expected direction when attached

Started by bitterman, April 02, 2018, 08:44:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bitterman

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.

bitterman

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 );



bitterman

Some related info (not for weapons):

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?

The Happy Friar

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."  :)

bitterman


The Happy Friar

bone structure is the most important part, once that's done everything else is just verts bound to the bones.
Good job.  :)