PhysicalAnimationSystem
Drives a bone chain with motor-powered physics blended onto the animated pose, so hit reactions knock a limb off the animation and then recover.
- Module
- Physics
- Header
#include "Physics/PhysicalAnimationSystem.h"- Namespace
Mowo
Tick order: runs AFTER PhysicsSystem (bodies already stepped this frame) and AFTER AnimationSystem (boneMatrices carry the animated pose). It drives the motors toward the just-computed animated pose, reads the stepped bodies back, and blends them into the chain's bones by the current physics weight. Because the sim is fixed-step (1/60) and this runs post-step, the readback samples a settled pose and the motor targets set here take effect on the next step.
Public functions
| Returns | Name | Description |
|---|---|---|
void | Initialize | |
void | Shutdown | |
void | Update | |
std::vector<uint8_t> | ResolveChain | Chain = the named root bone plus (when includeChildren) every descendant. |
std::vector<FPhysicalAnimationProfile> | ResolveBoneProfiles | Motor gains per bone: the component profile everywhere, replaced on each override's bone and (when it includes children) that bone's descendants. |
float | DecayImpulseWeight | Pulse decay: the physics contribution falls to zero over recoverTime. |
float | EffectiveWeight | Effective per-frame physics weight applied to the chain bones. |
Function details
Initialize
void Initialize(World* world) overrideShutdown
void Shutdown() overrideUpdate
void Update(float deltaTime) overrideResolveChain
static std::vector<uint8_t> ResolveChain(const Skeleton& skeleton, const std::string& rootBoneName, bool includeChildren)Chain = the named root bone plus (when includeChildren) every descendant. Empty rootBoneName selects the whole skeleton. Returns a per-bone mask (1 = in chain). Pure — no physics, CPU-testable.
ResolveBoneProfiles
static std::vector<FPhysicalAnimationProfile> ResolveBoneProfiles(const Skeleton& skeleton, const PhysicalAnimationComponent& pa)Motor gains per bone: the component profile everywhere, replaced on each override's bone and (when it includes children) that bone's descendants. Later overrides win on overlap, so a broad entry can be narrowed by a deeper one. Bones outside the driven chain get an entry too — the caller only reads the driven ones. Pure — no physics, CPU-testable.
DecayImpulseWeight
static float DecayImpulseWeight(float current, float dt, float recoverTime)Pulse decay: the physics contribution falls to zero over recoverTime.
EffectiveWeight
static float EffectiveWeight(bool continuous, float blendWeight, float impulseWeight)Effective per-frame physics weight applied to the chain bones.