|
group2 0.1.0
CSE 125 Group 2
|
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>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). | |
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.
|
strong |
|
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.