41class PhysicsSystem :
public System {
43 PhysicsSystem() =
default;
44 ~PhysicsSystem()
override =
default;
46 PhysicsSystem(
const PhysicsSystem& other) =
delete;
47 PhysicsSystem& operator=(
const PhysicsSystem& other) =
delete;
49 PhysicsSystem(PhysicsSystem && other) =
delete;
50 PhysicsSystem& operator=(PhysicsSystem && other) =
delete;
67 glm::vec3 holdImpulse;
82 bool gatherBodies(Scene& scene,
const ResourceManager& resources,
const NetSession& net);
92 void integrateForces(
const PhysicsSettings& physics,
float dt);
109 void narrowphase(
bool replaying);
119 void collidePair(uint32_t pair, NarrowphaseChunk& chunk)
const;
137 bool isIslandMember(uint32_t body)
const;
148 void gatherJoints(Scene& scene);
156 void solve(
const PhysicsSettings& physics,
float dt);
166 void sleepIslands(
bool replaying);
177 void writeback(Scene& scene,
bool replaying,
float dt);
189 void reportContacts(
const Scene& scene, EventBus& events);
201 void leaseContacts(Scene& scene, NetSession& net);
204 std::vector<EntityId> m_bodies;
212 std::vector<PhysicsBody> m_solverBodies;
213 std::vector<EntityId> m_leased;
214 std::vector<uint8_t> m_leaseCarries;
215 BodyIslands m_leaseIslands;
216 std::vector<ContactManifold> m_manifolds;
218 ContactCache m_contactCache;
219 uint64_t m_worldEpoch = 0;
220 std::vector<JointConstraint> m_joints;
227 std::vector<HeldJoint> m_jointImpulses;
234 std::vector<uint32_t> m_bodyIndexBySlot;
242 std::vector<uint64_t> m_jointedPairs;
245 std::vector<ColliderProxy> m_proxies;
247 std::vector<BodyFrame> m_bodyFrames;
250 BodyIslands m_islands;
252 std::vector<uint8_t> m_islandHeld;
253 std::vector<uint8_t> m_islandDisturbed;
255 std::vector<uint8_t> m_islandReady;
257 std::vector<BodyContacts> m_contacts;
262 std::vector<TrackedPair> m_touchingThisTick;
269 std::vector<TrackedPair> m_touchingLastTick;
271 FaultLatch m_massless;
273 std::vector<uint32_t> m_sorted;
274 std::vector<std::pair<uint32_t, uint32_t>> m_pairs;
276 std::vector<BoxShape> m_shapeBoxes;
277 std::vector<Math::AABB> m_shapeBoxBounds;
278 std::vector<CapsuleShape> m_shapeCapsules;
280 std::vector<Math::AABB> m_shapeCapsuleBounds;
287 std::vector<NarrowphaseChunk> m_narrowphaseChunks;
289 std::vector<bool> m_posedBone;
Per-frame state bundle passed to every system.
Definition system.h:55