group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
Ragdoll.hpp
Go to the documentation of this file.
1
14
15#pragma once
16
18
19#include <array>
20#include <cstdint>
21#include <entt/entt.hpp>
22#include <type_traits>
23
31inline constexpr bool kRagdollsEnabled = false;
32
35enum class RagdollBone : uint8_t
36{
37 Head = 0,
38 Torso = 1,
39 Pelvis = 2,
44 HandL = 7,
45 HandR = 8,
50 FootL = 13,
51 FootR = 14,
52 Count = 15,
53};
54
63
64static_assert(std::is_trivially_copyable_v<RagdollBoneTag>,
65 "RagdollBoneTag must be trivially copyable for network serialization");
66
71struct Ragdoll
72{
73 std::array<entt::entity, static_cast<size_t>(RagdollBone::Count)> bodies{};
74 std::array<entt::entity, 14u> joints{};
75
78 float age = 0.0f;
79};
Network client identifier component for multiplayer entities.
constexpr bool kRagdollsEnabled
Master switch for the ragdoll feature (creation, physics, rendering).
Definition Ragdoll.hpp:31
RagdollBone
Standard humanoid bone indices for the 15-body ragdoll.
Definition Ragdoll.hpp:36
@ FootL
Definition Ragdoll.hpp:50
@ UpperLegR
Definition Ragdoll.hpp:47
@ LowerLegL
Definition Ragdoll.hpp:48
@ HandR
Definition Ragdoll.hpp:45
@ LowerLegR
Definition Ragdoll.hpp:49
@ Torso
Definition Ragdoll.hpp:38
@ Head
Definition Ragdoll.hpp:37
@ ForearmR
Definition Ragdoll.hpp:43
@ FootR
Definition Ragdoll.hpp:51
@ UpperArmR
Definition Ragdoll.hpp:41
@ UpperArmL
Definition Ragdoll.hpp:40
@ ForearmL
Definition Ragdoll.hpp:42
@ UpperLegL
Definition Ragdoll.hpp:46
@ Pelvis
Definition Ragdoll.hpp:39
@ Count
Definition Ragdoll.hpp:52
@ HandL
Definition Ragdoll.hpp:44
Associates an entity with a connected network client.
Definition ClientId.hpp:10
Marker on each ragdoll-body entity; points back to the parent ragdoll character and which bone slot t...
Definition Ragdoll.hpp:58
ClientId characterId
Definition Ragdoll.hpp:60
entt::entity character
Definition Ragdoll.hpp:59
RagdollBone bone
Definition Ragdoll.hpp:61
Parent component on the dead character; holds the 15 ragdoll body entities and the joint entities con...
Definition Ragdoll.hpp:72
float age
Seconds since ragdoll spawn.
Definition Ragdoll.hpp:78
std::array< entt::entity, 14u > joints
14 joints for 15 bones in tree topology.
Definition Ragdoll.hpp:74
std::array< entt::entity, static_cast< size_t >(RagdollBone::Count)> bodies
Definition Ragdoll.hpp:73