BsCBoxCollider.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. #include "BsBoxCollider.h"
  6. #include "BsCCollider.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Components-Core
  10. * @{
  11. */
  12. /**
  13. * @copydoc BoxCollider
  14. *
  15. * Wraps BoxCollider as a Component.
  16. */
  17. class BS_CORE_EXPORT CBoxCollider : public CCollider
  18. {
  19. public:
  20. CBoxCollider(const HSceneObject& parent, const Vector3& extents = Vector3::ONE);
  21. /** @copydoc BoxCollider::setExtents */
  22. void setExtents(const Vector3& extents);
  23. /** @copydoc BoxCollider::getExtents */
  24. Vector3 getExtents() const { return mExtents; }
  25. /** Sets the position of the box shape, relative to the component's scene object. */
  26. void setCenter(const Vector3& center);
  27. /** Gets the position of the box shape, relative to the component's scene object. */
  28. Vector3 getCenter() const { return mLocalPosition; }
  29. /** Returns the box collider that this component wraps. */
  30. SPtr<BoxCollider> _getInternal() const { return std::static_pointer_cast<BoxCollider>(mInternal); }
  31. /************************************************************************/
  32. /* COMPONENT OVERRIDES */
  33. /************************************************************************/
  34. protected:
  35. friend class SceneObject;
  36. /** @copydoc CCollider::createInternal */
  37. SPtr<Collider> createInternal() override;
  38. protected:
  39. Vector3 mExtents;
  40. /************************************************************************/
  41. /* RTTI */
  42. /************************************************************************/
  43. public:
  44. friend class CBoxColliderRTTI;
  45. static RTTITypeBase* getRTTIStatic();
  46. RTTITypeBase* getRTTI() const override;
  47. protected:
  48. CBoxCollider() {} // Serialization only
  49. };
  50. /** @} */
  51. }