ArticulationsUtilities.h 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Component/Entity.h>
  10. #include <AzCore/std/optional.h>
  11. #include <AzFramework/Physics/Common/PhysicsSimulatedBody.h>
  12. #include <PhysX/ArticulationTypes.h>
  13. namespace ROS2Controllers::Utils
  14. {
  15. //! Retrieve root of articulation for given entity. If the entity is not part of an articulation, the invalid entity id is returned.
  16. //! @param entityId The entity to get the root of.
  17. //! @return The root of articulation.
  18. AZ::EntityId GetRootOfArticulation(AZ::EntityId entityId);
  19. //! Get handles to all the articulation links in an articulation tree.
  20. //! @param sceneHandle A handle to the scene.
  21. //! @param entityId Any entity in the articulation tree.
  22. //! @return Handles to all the articulation links in the tree.
  23. AZStd::unordered_map<AZ::EntityId, AzPhysics::SimulatedBodyHandle> GetSimulatedBodyHandles(
  24. AzPhysics::SceneHandle sceneHandle, AZ::EntityId entityId);
  25. //! Try to get a free articulation axis of an articulation link.
  26. //! @param entityId The entity with the articulation link.
  27. //! @return a free articulation axis if found and nullopt if not.
  28. AZStd::optional<PhysX::ArticulationJointAxis> TryGetFreeArticulationAxis(const AZ::EntityId& entityId);
  29. } // namespace ROS2Controllers::Utils