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

What held each contacting pair when the last tick finished. More...

#include <contact_cache.h>

Public Member Functions

void seed (std::vector< ContactManifold > &manifolds, const std::vector< EntityId > &entities, const std::vector< BodyFrame > &frames) const
 Give every contact the impulse its pair carried last tick.
void record (const std::vector< ContactManifold > &manifolds, const std::vector< EntityId > &entities, const std::vector< BodyFrame > &frames)
 Replace the store with what the solve just settled on.
void clear ()
 Forget everything, for a world that is being replaced.

Detailed Description

What held each contacting pair when the last tick finished.

The answer barely changes between ticks, so it seeds sequential impulses. Contacts match by position, since the narrowphase names no features, kept in both bodies' frames and matched in either, so a pair on a moving platform or a box sliding over the floor matches itself.

Not rolled back: a replay is seeded from the last simulated tick. The seed is a guess the passes correct, so this costs a replay precision, not its answer.

Member Function Documentation

◆ seed()

void Vkm::Engine::ContactCache::seed ( std::vector< ContactManifold > & manifolds,
const std::vector< EntityId > & entities,
const std::vector< BodyFrame > & frames ) const

Give every contact the impulse its pair carried last tick.

Parameters
manifoldsThis tick's manifolds, seeded in place.
entitiesBody entities, indexed by the manifolds' body indices.
framesEach body's pose as gathered, the frame a point is kept in.

◆ record()

void Vkm::Engine::ContactCache::record ( const std::vector< ContactManifold > & manifolds,
const std::vector< EntityId > & entities,
const std::vector< BodyFrame > & frames )

Replace the store with what the solve just settled on.

Stores the solve's lever arms in each body's frame as gathered, before the tick moved it, as seed measures.

Parameters
manifoldsThe solved manifolds, with final impulses and lever arms.
entitiesBody entities, indexed by the manifolds' body indices.
framesEach body's pose as gathered, not as the tick left it.

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