![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
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. | |
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.
| 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.
| manifolds | This tick's manifolds, seeded in place. |
| entities | Body entities, indexed by the manifolds' body indices. |
| frames | Each body's pose as gathered, the frame a point is kept in. |
| 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.
| manifolds | The solved manifolds, with final impulses and lever arms. |
| entities | Body entities, indexed by the manifolds' body indices. |
| frames | Each body's pose as gathered, not as the tick left it. |