From 409dad41b604d5598ab8fa6427afd9bc945b5670 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Thu, 1 Oct 2026 17:40:29 -0500 Subject: [PATCH] feat(entity): a model with behaviors gets no physics from the physics cases As LWOControllablePhysComponent's and LWOPhantomPhysicsComponent's allocators do (like the simple physics one already): the registry's physics id is left to the model case, which makes the model's physics. Co-Authored-By: Claude Opus 5.5 --- dGame/Entity.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 3da95861b..863806244 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -348,7 +348,10 @@ void Entity::DoObjectComponentLoad(ObjectLoadState& state) { } case eReplicaComponentType::CONTROLLABLE_PHYSICS: { const auto controllablePhysicsComponentID = state.GetComponentID(eReplicaComponentType::CONTROLLABLE_PHYSICS); - if (controllablePhysicsComponentID > 0) { + if (state.hasModelBehaviors) { + // LWOControllablePhysComponent::Allocator: left to the model case + if (controllablePhysicsComponentID > 0) state.modelPhysicsComponentID = controllablePhysicsComponentID; + } else if (controllablePhysicsComponentID > 0) { // The component places it: where the level put an object, where a character's save and the zone put it auto* controllablePhysics = AddComponent(controllablePhysicsComponentID); if (m_Character) controllablePhysics->LoadFromSaveData(m_Character->GetXMLDoc()); @@ -388,7 +391,10 @@ void Entity::DoObjectComponentLoad(ObjectLoadState& state) { } case eReplicaComponentType::PHANTOM_PHYSICS: { const auto phantomPhysicsComponentID = state.GetComponentID(eReplicaComponentType::PHANTOM_PHYSICS); - if (phantomPhysicsComponentID > 0 && !HasComponent(eReplicaComponentType::PHANTOM_PHYSICS)) { + if (state.hasModelBehaviors) { + // LWOPhantomPhysicsComponent::Allocator: left to the model case + if (phantomPhysicsComponentID > 0) state.modelPhysicsComponentID = phantomPhysicsComponentID; + } else if (phantomPhysicsComponentID > 0 && !HasComponent(eReplicaComponentType::PHANTOM_PHYSICS)) { AddComponent(phantomPhysicsComponentID)->SetPhysicsEffectActive(false); } break;