This commit is contained in:
2025-09-20 23:14:17 +03:00
parent e967844558
commit fea7c71788
18 changed files with 158 additions and 15 deletions

View File

@@ -733,6 +733,33 @@ CharacterModule::CharacterModule(flecs::world &ecs)
<< "\n";
});
#endif
ecs.system<const EngineData, const CharacterBase, CharacterSlot>(
"UpdatePhysics2")
.kind(flecs::OnUpdate)
.with<CharacterDisablePhysics>()
.each([](flecs::entity e, const EngineData &eng,
const CharacterBase &ch, CharacterSlot &slot) {
if (slot.parent_e.has<VehicleSlots>()) {
const VehicleSlots &slots =
slot.parent_e.get<VehicleSlots>();
if (slots.seats.find(slot.slot_name) ==
slots.seats.end())
// invalid setting
e.remove<CharacterSlot>();
if (slot.activated)
return;
Ogre::SceneNode *slot_base =
slots.seats.at(slot.slot_name).second;
Ogre::Vector3 position =
slot_base->_getDerivedPosition();
Ogre::Quaternion orientation =
slot_base->_getDerivedOrientation();
ch.mBodyNode->_setDerivedPosition(position);
ch.mBodyNode->_setDerivedOrientation(
orientation);
slot.activated = true;
}
});
ecs.system<const EngineData, const CharacterBody>("UpdatePhysics")
.kind(flecs::OnUpdate)
.with<CharacterUpdatePhysicsState>()