vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::Ragdoll Struct Reference

Turns a rig over to physics, and back. More...

#include <ragdoll.h>

Public Attributes

bool active = false
 Physics drives the rig when true.
EntityId root {}
 Node the bones are grouped under.
int boneLayer = 1 << 1
 The layer bit the bones were built on.
float rigScale = 1.0f
 The rig's world scale when the bones were built.
std::vector< RagdollBone > bones
 One per simulated bone.
bool held = false
 The pose held the bones last tick; runtime, not serialized.

Detailed Description

Turns a rig over to physics, and back.

Ordinary bodies and joints shaped like a skeleton, plus which body poses which bone, so one skinned mesh can be driven by a clip one frame and the solver the next.

active is the whole switch. False holds the bodies kinematic, placed from the animated pose every tick at its speed, so activation inherits the character's real shape and motion. The bones are siblings under root, a child of this entity, not nested, so a hip cannot move a shin behind the solver's back.

Member Data Documentation

◆ boneLayer

int Vkm::Engine::Ragdoll::boneLayer = 1 << 1

The layer bit the bones were built on.

The build takes it out of the owner's collidesWith; this is what puts it back when the ragdoll goes.

◆ rigScale

float Vkm::Engine::Ragdoll::rigScale = 1.0f

The rig's world scale when the bones were built.

Every bone's offset carries it. Recorded so a scale change is checked against the rig, not a posed bone an animation may scale on purpose.


The documentation for this struct was generated from the following file: