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

Keeps a ragdoll's bodies in step with whichever is in charge. More...

#include <ragdoll_system.h>

Inheritance diagram for Vkm::Engine::RagdollSystem:
Vkm::Engine::System Vkm::Engine::ISceneObserver

Public Member Functions

void init (FrameContext &ctx) override
 Called once after all systems are registered, before the first update.
void fixedUpdate (FrameContext &ctx) override
 Execute this system at the fixed simulation rate.
void shutdown () override
 Drops the observer registration, so nothing calls a dead system.
void onEntityDestroyed (EntityId id) override
 Destroy a ragdoll's bones when the thing they belong to goes.
Public Member Functions inherited from Vkm::Engine::System
virtual bool isReplayed () const
 Whether this system may be re-run over a tick that already happened.
virtual void update (FrameContext &ctx)
 Execute this system for the current frame.

Detailed Description

Keeps a ragdoll's bodies in step with whichever is in charge.

The bodies exist, and so simulate, whether or not the ragdoll is active. Inactive, they are kinematic hitboxes (see isPosedByAnimation) placed from the animated pose every tick with its velocity, so activation hands the solver the character's real shape and motion.

Runs on the tick, after SkeletalAnimationSystem, whose pose it reads, and before PhysicsSystem, so the solver reads these bone transforms the same step.

Member Function Documentation

◆ init()

void Vkm::Engine::RagdollSystem::init ( FrameContext & ctx)
overridevirtual

Called once after all systems are registered, before the first update.

Parameters
ctxThe first frame's context; its products are all null.

Reimplemented from Vkm::Engine::System.

◆ fixedUpdate()

void Vkm::Engine::RagdollSystem::fixedUpdate ( FrameContext & ctx)
overridevirtual

Execute this system at the fixed simulation rate.

Called 0+ times per frame; the step is ctx.clock.getFixedStep().

Runs before any producer stage, so ctx.visibility and ctx.ui are null here. ctx.poses is set by SkeletalAnimationSystem's own fixedUpdate, so a later Simulation system reads this tick's pose.

Parameters
ctxThis frame's services; see above for which products are set.

Reimplemented from Vkm::Engine::System.

◆ onEntityDestroyed()

void Vkm::Engine::RagdollSystem::onEntityDestroyed ( EntityId id)
overridevirtual

Destroy a ragdoll's bones when the thing they belong to goes.

A plain destroyEntity does not walk children, and a bone moved out of the group escapes one that does; an observer catches every destroy, gameplay's included.

Parameters
idThe entity being destroyed.

Implements Vkm::Engine::ISceneObserver.


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