Author Topic: How to oriented bone to spawn other model in expected direction when attached  (Read 2535 times)

0 Members and 2 Guests are viewing this topic.

bitterman

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: +9/-5
  • Doom Newbie
    • View Profile
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.
« Last Edit: April 02, 2018, 08:47:02 AM by bitterman »

bitterman

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: +9/-5
  • Doom Newbie
    • View Profile
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.

Code: [Select]
/*
================
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 );

« Last Edit: April 03, 2018, 10:41:56 AM by bitterman »

bitterman

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: +9/-5
  • Doom Newbie
    • View Profile
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?
« Last Edit: April 04, 2018, 01:01:06 PM by bitterman »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 1,031
  • Karma: +46/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
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

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: +9/-5
  • Doom Newbie
    • View Profile
Don't even smile - it's just a prototype.

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 1,031
  • Karma: +46/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
bone structure is the most important part, once that's done everything else is just verts bound to the bones.
Good job.  :)