diff --git a/Gems/SensorDebug/Code/Source/Clients/SensorDebugSystemComponent.cpp b/Gems/SensorDebug/Code/Source/Clients/SensorDebugSystemComponent.cpp index 2da7e855..702c569c 100644 --- a/Gems/SensorDebug/Code/Source/Clients/SensorDebugSystemComponent.cpp +++ b/Gems/SensorDebug/Code/Source/Clients/SensorDebugSystemComponent.cpp @@ -186,12 +186,11 @@ namespace SensorDebug ImGui::Begin("ROS2 SensorDebugger"); ImGui::Separator(); ImGui::Text("TimeyWimey Stuff"); - - auto ros2ts = ROS2::ROS2Interface::Get()->GetROSTimestamp(); + const auto ros2Intreface = ROS2::ROS2Interface::Get(); + auto ros2ts = ros2Intreface ? ROS2::ROS2Interface::Get()->GetROSTimestamp() : builtin_interfaces::msg::Time(); const float ros2tsSec = ros2ts.sec + ros2ts.nanosec / 1e9; - auto ros2Node = ROS2::ROS2Interface::Get()->GetNode(); - - auto nodeTime = ros2Node->now(); + auto ros2Node = ros2Intreface ? ROS2::ROS2Interface::Get()->GetNode() : nullptr; + auto nodeTime = ros2Node ? ros2Node->now() : rclcpp::Time(0, 0); const float ros2nodetsSec = nodeTime.seconds() + nodeTime.nanoseconds() / 1e9; auto timeSystem = AZ::Interface::Get(); @@ -204,7 +203,7 @@ namespace SensorDebug ImGui::Separator(); ImGui::Text("PhysX"); ImGui::InputFloat("Fixed timestamp", &ModifiedPhysXConfig.m_fixedTimestep, 0.0f, 0.0f, "%.6f"); - ImGui::InputFloat("Max timestamp", &ModifiedPhysXConfig.m_maxTimestep, 0.0f, 0.0f, "%.6f"git a); + ImGui::InputFloat("Max timestamp", &ModifiedPhysXConfig.m_maxTimestep, 0.0f, 0.0f, "%.6f"); if (ImGui::Button("Update PhysX Config")) { UpdatePhysXConfig(); diff --git a/Gems/SensorDebug/Code/Source/Clients/SensorDebugSystemComponent.h b/Gems/SensorDebug/Code/Source/Clients/SensorDebugSystemComponent.h index 0b2ec7cd..2a3d588c 100644 --- a/Gems/SensorDebug/Code/Source/Clients/SensorDebugSystemComponent.h +++ b/Gems/SensorDebug/Code/Source/Clients/SensorDebugSystemComponent.h @@ -62,10 +62,6 @@ namespace SensorDebug AZStd::vector m_appFrequencies; float m_maxFPS = 60.0f; int m_historySize = 1000; - - - - AzPhysics::Scene* m_scene = nullptr; }; } // namespace SensorDebug diff --git a/Gems/SensorDebug/Code/Source/Tools/SensorDebugEditorSystemComponent.cpp b/Gems/SensorDebug/Code/Source/Tools/SensorDebugEditorSystemComponent.cpp index d3b257b1..631270fa 100644 --- a/Gems/SensorDebug/Code/Source/Tools/SensorDebugEditorSystemComponent.cpp +++ b/Gems/SensorDebug/Code/Source/Tools/SensorDebugEditorSystemComponent.cpp @@ -19,23 +19,25 @@ namespace SensorDebug void SensorDebugEditorSystemComponent::Activate() { - SensorDebugSystemComponent::Activate(); + AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect(); } void SensorDebugEditorSystemComponent::Deactivate() { AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect(); - SensorDebugSystemComponent::Deactivate(); + } void SensorDebugEditorSystemComponent::OnStartPlayInEditorBegin() { ClearSensors(); + SensorDebugSystemComponent::Activate(); } void SensorDebugEditorSystemComponent::OnStopPlayInEditor() { ClearSensors(); + SensorDebugSystemComponent::Deactivate(); } } // namespace SensorDebug