Refactor MovingPlatformComponent to support subcomponents for movement and rotation

- Introduced PlatformSubComponent as a base class for platform movement logic.
- Added MoverSubComponent for standard path-following behavior.
- Implemented SimpleMoverSubComponent for auto-generating two-waypoint paths.
- Created RotatorSubComponent to handle angular velocity and rotation along paths.
- Updated MovingPlatformComponent to manage multiple subcomponents and their states.
- Modified serialization and update logic to accommodate new subcomponent architecture.
- Adjusted GameMessages to include additional parameters for platform state synchronization.
- Enhanced SimplePhysicsComponent to prevent double movement when on a moving platform.
- Added new CMakeLists.txt for organizing MovingPlatformComponent files.
This commit is contained in:
Aaron Kimbrell
2026-04-08 16:32:10 -05:00
parent 247576e101
commit 5e40aaf420
17 changed files with 1097 additions and 430 deletions

View File

@@ -12,6 +12,7 @@
#include "CDPhysicsComponentTable.h"
#include "Entity.h"
#include "MovingPlatformComponent.h"
#include "StringifiedEnum.h"
#include "Amf3.h"
@@ -39,6 +40,11 @@ SimplePhysicsComponent::~SimplePhysicsComponent() {
void SimplePhysicsComponent::Update(const float deltaTime) {
if (m_Velocity == NiPoint3Constant::ZERO) return;
// If this entity has a MovingPlatformComponent, it owns position updates.
// Don't double-move by also applying velocity here.
if (m_Parent->GetComponent<MovingPlatformComponent>()) return;
m_Position += m_Velocity * deltaTime;
m_DirtyPosition = true;
Game::entityManager->SerializeEntity(m_Parent);