group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
Ragdoll.hpp File Reference

Ragdoll components — bone-to-rigid-body mapping for character death. More...

#include "ecs/components/ClientId.hpp"
#include <array>
#include <cstdint>
#include <entt/entt.hpp>
#include <type_traits>
Include dependency graph for Ragdoll.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  RagdollBoneTag
 Marker on each ragdoll-body entity; points back to the parent ragdoll character and which bone slot this body fills. More...
struct  Ragdoll
 Parent component on the dead character; holds the 15 ragdoll body entities and the joint entities connecting them. More...

Enumerations

enum class  RagdollBone : uint8_t {
  Head = 0 , Torso = 1 , Pelvis = 2 , UpperArmL = 3 ,
  UpperArmR = 4 , ForearmL = 5 , ForearmR = 6 , HandL = 7 ,
  HandR = 8 , UpperLegL = 9 , UpperLegR = 10 , LowerLegL = 11 ,
  LowerLegR = 12 , FootL = 13 , FootR = 14 , Count = 15
}
 Standard humanoid bone indices for the 15-body ragdoll. More...

Variables

constexpr bool kRagdollsEnabled = false
 Master switch for the ragdoll feature (creation, physics, rendering).

Detailed Description

Ragdoll components — bone-to-rigid-body mapping for character death.

On character death the gameplay code calls spawnRagdoll(...) which allocates 15 rigid bodies (one per major bone) and the joints connecting them. The new bodies are owned by a Ragdoll parent component on the character entity; destroying the character also destroys all its ragdoll children.

Renderer integration: each ragdoll body carries a RagdollBoneTag linking it back to the source character + bone index; the skinning system reads the body's Position + Orientation and pipes them into the bone palette for that character.

Enumeration Type Documentation

◆ RagdollBone

enum class RagdollBone : uint8_t
strong

Standard humanoid bone indices for the 15-body ragdoll.

Order matches the joint table in Ragdoll::buildHumanoid.

Enumerator
Head 
Torso 
Pelvis 
UpperArmL 
UpperArmR 
ForearmL 
ForearmR 
HandL 
HandR 
UpperLegL 
UpperLegR 
LowerLegL 
LowerLegR 
FootL 
FootR 
Count 

Variable Documentation

◆ kRagdollsEnabled

bool kRagdollsEnabled = false
inlineconstexpr

Master switch for the ragdoll feature (creation, physics, rendering).

When false, dead characters simply disappear instead of spawning a corpse: spawnRagdoll is skipped, runRagdolls/PBD stepping is skipped, and the renderer draws no ragdoll body. The ragdoll code is left intact so the feature can be re-enabled by flipping this to true. Disabled because the simulation didn't look good enough to be worth the cost.