JointComponent.h 994 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Scene/Components/SceneComponent.h>
  7. #include <AnKi/Physics2/PhysicsJoint.h>
  8. namespace anki {
  9. /// @addtogroup scene
  10. /// @{
  11. /// @memberof JointComponent
  12. enum class JointType : U8
  13. {
  14. kPoint,
  15. kHinge,
  16. kCount,
  17. kFirst
  18. };
  19. /// Contains a single joint that connects the parent node with the 1st child node of the node that has this component.
  20. class JointComponent : public SceneComponent
  21. {
  22. ANKI_SCENE_COMPONENT(JointComponent)
  23. public:
  24. JointComponent(SceneNode* node);
  25. ~JointComponent();
  26. void setType(JointType type)
  27. {
  28. m_type = type;
  29. }
  30. private:
  31. v2::PhysicsJointPtr m_joint;
  32. U32 m_parentNodeUuid = 0;
  33. U32 m_childNodeUuid = 0;
  34. JointType m_type = JointType::kCount;
  35. Error update(SceneComponentUpdateInfo& info, Bool& updated) override;
  36. };
  37. /// @}
  38. } // end namespace anki