diff --git a/Gems/Multiplayer/Code/Include/Multiplayer/Physics/PhysicsUtils.h b/Gems/Multiplayer/Code/Include/Multiplayer/Physics/PhysicsUtils.h deleted file mode 100644 index a93dcc7a65..0000000000 --- a/Gems/Multiplayer/Code/Include/Multiplayer/Physics/PhysicsUtils.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -namespace Multiplayer -{ - namespace Physics - { - //! Performs rewind-aware ray cast in the default physics world. - //! @param request The ray cast request to make. - //! @return Returns a structure that contains a list of Hits. - AzPhysics::SceneQueryHits RayCast(const AzPhysics::RayCastRequest& request); - - //! Performs rewind-aware shape cast in the default physics world. - //! @param request The shape cast request to make. - //! @return Returns a structure that contains a list of Hits. - AzPhysics::SceneQueryHits ShapeCast(const AzPhysics::ShapeCastRequest& request); - - //! Performs rewind-aware overlap in the default physics world. - //! @param request The overlap request to make. - //! @return Returns a structure that contains a list of Hits. - AzPhysics::SceneQueryHits Overlap(const AzPhysics::OverlapRequest& request); - - } // namespace Physics -} // namespace Multiplayer diff --git a/Gems/Multiplayer/Code/Source/Physics/PhysicsUtils.cpp b/Gems/Multiplayer/Code/Source/Physics/PhysicsUtils.cpp deleted file mode 100644 index c6f5a56422..0000000000 --- a/Gems/Multiplayer/Code/Source/Physics/PhysicsUtils.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -#include -#include -#include -#include - -namespace -{ - template - AzPhysics::SceneQueryHits SceneQueryInternal(const RequestT& request) - { - auto* sceneInterface = AZ::Interface::Get(); - if (!sceneInterface) - { - return {}; - } - - AzPhysics::SceneHandle sceneHandle = sceneInterface->GetSceneHandle(AzPhysics::DefaultPhysicsSceneName); - if (sceneHandle == AzPhysics::InvalidSceneHandle) - { - return {}; - } - - Multiplayer::INetworkTime* currentNetTime = Multiplayer::GetNetworkTime(); - - if(!currentNetTime->IsTimeRewound()) - { - // If the time is not rewound, we simply execute the scene query as is. - AzPhysics::SceneQueryHits result = sceneInterface->QueryScene(sceneHandle, &request); - return result; - } - - // If the time is rewound, we want to query against rigid bodies present at the same frame ID: the same as the current rewound time is. - RequestT netSceneQueryRequest = request; - netSceneQueryRequest.m_filterCallback = [&request, currentFrameId = (uint32_t)currentNetTime->GetHostFrameId()]( - const AzPhysics::SimulatedBody* body, const ::Physics::Shape* shape) - { - if (body->GetFrameId() == AzPhysics::SimulatedBody::UndefinedFrameId || body->GetFrameId() == currentFrameId) - { - if (request.m_filterCallback) - { - return request.m_filterCallback(body, shape); - } - - // Overlap filter callbacks return true/false rather than Touch/Block/None - if constexpr (AZStd::is_same_v) - { - return true; - } - else - { - return AzPhysics::SceneQuery::QueryHitType::Touch; - } - } - - if constexpr (AZStd::is_same_v) - { - return false; - } - else - { - return AzPhysics::SceneQuery::QueryHitType::None; - } - }; - - // Execute the scene query modified for the time rewind. - AzPhysics::SceneQueryHits result = sceneInterface->QueryScene(sceneHandle, &netSceneQueryRequest); - return result; - } -} - -namespace Multiplayer -{ - namespace Physics - { - AzPhysics::SceneQueryHits RayCast(const AzPhysics::RayCastRequest& request) - { - return SceneQueryInternal(request); - } - - AzPhysics::SceneQueryHits ShapeCast(const AzPhysics::ShapeCastRequest& request) - { - return SceneQueryInternal(request); - } - - AzPhysics::SceneQueryHits Overlap(const AzPhysics::OverlapRequest& request) - { - return SceneQueryInternal(request); - } - } // namespace Physics -} // namespace Multiplayer diff --git a/Gems/Multiplayer/Code/multiplayer_files.cmake b/Gems/Multiplayer/Code/multiplayer_files.cmake index 7c5f3a946b..9c83af49a3 100644 --- a/Gems/Multiplayer/Code/multiplayer_files.cmake +++ b/Gems/Multiplayer/Code/multiplayer_files.cmake @@ -57,7 +57,6 @@ set(FILES Include/Multiplayer/NetworkTime/RewindableFixedVector.inl Include/Multiplayer/NetworkTime/RewindableObject.h Include/Multiplayer/NetworkTime/RewindableObject.inl - Include/Multiplayer/Physics/PhysicsUtils.h Include/Multiplayer/ReplicationWindows/IReplicationWindow.h Include/Multiplayer/AutoGen/AutoComponentTypes_Header.jinja Include/Multiplayer/AutoGen/AutoComponentTypes_Source.jinja