Physics initialization update

This commit is contained in:
2026-02-07 08:31:07 +03:00
parent a54b042e49
commit 685b15933a
3 changed files with 13 additions and 10 deletions

View File

@@ -61,15 +61,6 @@ PhysicsModule::PhysicsModule(flecs::world &ecs)
ecs.component<CachedMass>();
ecs.import <TerrainModule>();
ecs.import <WaterModule>();
ecs.system<const EngineData, const Camera>("physics_init")
.kind(PhysicsPreUpdate)
.without<Physics>()
.each([&](const EngineData &e, const Camera &c) {
Physics &ph = ECS::get().ensure<Physics>();
ph.physics = new JoltPhysicsWrapper(e.mScnMgr,
c.mCameraNode);
ECS::modified<Physics>();
});
ecs.system<EngineData, Physics>("physics_update")
.kind(PhysicsUpdate)
.each([&](EngineData &e, Physics &ph) {
@@ -633,6 +624,15 @@ void PhysicsModule::setDebugDraw(bool enable)
{
JoltPhysicsWrapper::getSingleton().setDebugDraw(enable);
}
void PhysicsModule::configurePhysics()
{
Physics &ph = ECS::get().ensure<Physics>();
const EngineData &e = ECS::get<EngineData>();
const Camera &c = ECS::get<Camera>();
ph.physics = new JoltPhysicsWrapper(e.mScnMgr, c.mCameraNode);
ECS::modified<Physics>();
}
bool WaterBody::isInWater(const JPH::BodyID &id) const
{
flecs::entity e =