feat: debug for all physics components and fix inspect by ldf key (#1848)

This commit is contained in:
David Markowitz
2025-07-19 22:08:18 -07:00
committed by GitHub
parent 4c42eea819
commit ba964932b7
15 changed files with 217 additions and 10 deletions

View File

@@ -12,8 +12,12 @@
#include "CDPhysicsComponentTable.h"
#include "Entity.h"
#include "StringifiedEnum.h"
#include "Amf3.h"
SimplePhysicsComponent::SimplePhysicsComponent(Entity* parent, int32_t componentID) : PhysicsComponent(parent, componentID) {
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &SimplePhysicsComponent::OnGetObjectReportInfo);
m_Position = m_Parent->GetDefaultPosition();
m_Rotation = m_Parent->GetDefaultRotation();
@@ -71,3 +75,20 @@ void SimplePhysicsComponent::SetPhysicsMotionState(uint32_t value) {
m_DirtyPhysicsMotionState = m_PhysicsMotionState != value;
m_PhysicsMotionState = value;
}
bool SimplePhysicsComponent::OnGetObjectReportInfo(GameMessages::GameMsg& msg) {
PhysicsComponent::OnGetObjectReportInfo(msg);
auto& reportInfo = static_cast<GameMessages::GetObjectReportInfo&>(msg);
auto& info = reportInfo.subCategory->PushDebug("Simple Physics Info");
auto& velocity = info.PushDebug("Velocity");
velocity.PushDebug<AMFDoubleValue>("x") = m_Velocity.x;
velocity.PushDebug<AMFDoubleValue>("y") = m_Velocity.y;
velocity.PushDebug<AMFDoubleValue>("z") = m_Velocity.z;
auto& angularVelocity = info.PushDebug("Angular Velocity");
angularVelocity.PushDebug<AMFDoubleValue>("x") = m_AngularVelocity.x;
angularVelocity.PushDebug<AMFDoubleValue>("y") = m_AngularVelocity.y;
angularVelocity.PushDebug<AMFDoubleValue>("z") = m_AngularVelocity.z;
info.PushDebug<AMFIntValue>("Physics Motion State") = m_PhysicsMotionState;
info.PushDebug<AMFStringValue>("Climbable Type") = StringifiedEnum::ToString(m_ClimbableType).data();
return true;
}