FFeetAnchoredBody
The placeholder body of anything whose origin is its feet: a character controller (its Jolt capsule is lifted by half its height), a nav agent (Detour writes the navmesh surface point into its position). The built-in "capsule" and "cylinder" primitives are centred on their origin and two metres tall, so drawn as they are such a body stood half underground at the wrong size. FitAll rebuilds them at the body's radius and height with their base on the origin every frame the size changed, and lifts any other primitive so its lowest point rests on the feet. Mesh assets keep their own pivot: an imported character (the mannequin) is authored feet-down already.
- Module
- Game
- Header
#include "Game/FeetAnchoredBody.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using FVisit = void (*)(void* context, EntityID entity, float radius, float height) | |
using FSource = void (*)(World& world, FVisit visit, void* context) | A module above Game (AINavigation) reports the feet-anchored entities it owns through this; character controllers are built in. Process-lifetime and captureless, the FAISignals rule. An entity reported twice keeps the last size, and the built-in source runs last. |
Public functions
| Returns | Name | Description |
|---|---|---|
void | AddSource | |
bool | IsSizedPrimitive | |
Mat4 | LocalTransform | What the body of this size draws with, relative to the entity origin. |
bool | MatchesSize | True when the mesh already has the extents of a primitive of this size. |
void | Fit | Fits one entity's renderer; a mesh is only rebuilt when the renderer is up and the entity already draws the primitive, so the material the hydration pass hands it is never skipped. |
void | FitAll |
Function details
AddSource
static void AddSource(FSource source)IsSizedPrimitive
static bool IsSizedPrimitive(const std::string& meshType)LocalTransform
static Mat4 LocalTransform(const std::string& meshType, float radius, float height, const GPUMesh* mesh)What the body of this size draws with, relative to the entity origin.
MatchesSize
static bool MatchesSize(const GPUMesh& mesh, float radius, float height)True when the mesh already has the extents of a primitive of this size.
Fit
static void Fit(MeshRendererComponent& mesh, float radius, float height)Fits one entity's renderer; a mesh is only rebuilt when the renderer is up and the entity already draws the primitive, so the material the hydration pass hands it is never skipped.
FitAll
static void FitAll(World& world)