Jump to content

[Solved] Death animation before ragdolls


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?

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.

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

    • peter_spy

      It's funny how perception changes over the years. I've been replaying Bioshock in its Remastered version, and I'm surprised how bad the level design actually is. It's just a series of abstract corridor mazes that you can't really map out in your head. There's nothing that would ground them in any kind of reality, fictional or otherwise, no sense of place people could live in. It's almost like Wolfenstein 3d with cool art deco assets.
      · 4 replies
    • STiFU

      Anyone here played Inscryption? At first, I was like "no, I am not going to play a stupid card game", but this game is so much more than that. It is so meta, full of 4th wall breaks, and feels so damn spooky and weird because of it. Absolutely recommended, if you can stand the visuals. I recommend not reading up too much on it, as that could easily spoil half the incredible surprises. Just know that what you see in the beginning is by far not everything.
      · 4 replies
    • freyk

      Tried to make a tdm advertisement commentpost at one of civvie11 youtube videos about T2. Post got marked as spam. His problem (to not discover TDM for himself),..not my problem.
      But some help of some fellow TDM yt-videocomment posters would be nice. To ask him and others, to play TDM. To get more players/creators. 
      · 5 replies
    • datiswous

      Currently Profile Information has 3 fields, these are shown in forum posts under your avatar:
      1. Gender
      2. Location
      3. Interests
      I think that it could be useful to have an extra field called "Operating system" (under location). It can be useful for tech support and to see what people use.
      Alternatively it could be a more general term, like PC system, so that you can for example state that you use an AMD gpu.
      · 2 replies
    • OrbWeaver

      Greetings fellow kids.
      · 11 replies
  • Create New...