Jump to content
The Dark Mod Forums

[Solved] Death animation before ragdolls


motorsep

Recommended Posts

Doom 3 coding question here!

 

One thing I am wondering about - how do I implement death animation preceding ragdoll kicking in? Has anyone tried implementing it in C++ code?

 

Right now it's death > ragdoll. I want death > death anim > ragdoll.

 

Thanks beforehand!

Edited by motorsep
Link to comment
Share on other sites

I think death and knockout animations were always intended but I think there was some technical issue that prevented them. Anyone correct me if I'm wrong about that. It may just be a priority or lack of coding help that it never got done.

 

I would personally love to see a return of the classic death / knockout anims.

Link to comment
Share on other sites

The code already exists for that inTDM, but there were a few arguments against using them for humanoids. The only one I remember off-hand is that the current set-up allows an impact to propagate to the ragdoll, so if you hit him from the left side he'll jerk to the right. If you had a death animation that wouldn't happen.

Link to comment
Share on other sites

Well, that still doesn't tell me where in the code of Doom 3 I should look, and what I should look for in order to add death anims preceding ragdolls (without propagating impact - that should somehow correlate to death animation; maybe an extra parameter specifying velocity on the impact)

Link to comment
Share on other sites

I've never used this, I've just done a regex search for "death|ragdoll" and it seems that in TDM, you just have to create an animation for an AI called "death" and set the "enable_death_anim" spawnarg. It uses the animState "Torso_Death" -- search your .script files for that to see whether you have the same setup. A lot of this was inherited from doom3, other bits have been added in TDM.

 

The "enable_death_anim" spawnarg is picked up by the game code and it delays the conversion to ragdoll. The parts of the c++ code that handle it are ai::DeadState::Init, idAI::Killed, and idAI::PostDeath. Try searching the Game project for "enable_death_anim". That spawnarg might or might not exist in your code. If not, search the TDM code for it and you'll see how and where TDM implemented this feature.

Link to comment
Share on other sites

Hmm. I'd spotted before that the origin of a ragdoll is its waist instead of the feet like it is for the living AI. Your ragdoll seems to be using the feet as the origin still -- probably because that's what the animation frame is using as its point of reference. So although the falling AI still has the right pose when he becomes a ragdoll, it's starting with the feet at the place the ragdoll's origin would have been if the death anim hadn't played. You likely need to apply an origin offset (SetOrigin) in the frame where the animation pose gets transferred to the ragdoll. There must be something similar happening in TDM code, even if we don't have animations that cross the life->death boundary.

Link to comment
Share on other sites

[quote name='motorsep' timestamp='1410499938' post='354282']
This is what's happening with my experiment: [url="https://www.youtube.com/watch?v=P2MSA_t7TOM"]https://www.youtube....h?v=P2MSA_t7TOM[/url]

Somehow, while posing ragdoll into animation pose works fine, location doesn't get set by stock Doom 3 StartRagdoll() code. Any ideas where is the issue?
[/quote]

As SteveL said, the origin seems to be off. Btw, the shader look great, I'd play this game :)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

:-) thanks. As for origin, I did everything like in Doom 3. I am sure somewhere is C++ code setting ragdoll to the entity's origin fails (in reality entity gets removed after death anim starts playing, and posed ragdoll gets shown)

 

If you look at StartRagdoll() code, and follow the trail down to the posing function, you'll see that there is SetWorldOrigin (or something like that) function that suppose to set bones of the ragdoll to the animated model's bones' locations. Not sure why and where it fails :-\

Link to comment
Share on other sites

Thanks :)

 

Well, from what I understood, the way ragdoll stuff works is it takes first child of the origin, which suppose to be Body bone (in doom 3) and aligns ragdoll by that bone. In my rig (perhaps Blender sorted it out on export) first child is eyes control bone. So, we implemented an option to specify first child bone in AF file (or if not specified, it falls back to stock behavior and then it just depends on the rig's hierarchy).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...