BsCSphereCollider.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 "BsSphereCollider.h"
  6. #include "BsCCollider.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Components-Core
  10. * @{
  11. */
  12. /**
  13. * @copydoc SphereCollider
  14. *
  15. * Wraps SphereCollider as a Component.
  16. */
  17. class BS_CORE_EXPORT CSphereCollider : public CCollider
  18. {
  19. public:
  20. CSphereCollider(const HSceneObject& parent, float radius = 1.0f);
  21. /** @copydoc SphereCollider::setRadius */
  22. void setRadius(float radius);
  23. /** @copydoc SphereCollider::getRadius */
  24. float getRadius() const { return mRadius; }
  25. /** Sets the position of the sphere shape, relative to the component's scene object. */
  26. void setCenter(const Vector3& center);
  27. /** Gets the position of the sphere shape, relative to the component's scene object. */
  28. Vector3 getCenter() const { return mLocalPosition; }
  29. /** @cond INTERNAL */
  30. /** Returns the sphere collider that this component wraps. */
  31. SphereCollider* _getInternal() const { return static_cast<SphereCollider*>(mInternal.get()); }
  32. /** @endcond */
  33. /************************************************************************/
  34. /* COMPONENT OVERRIDES */
  35. /************************************************************************/
  36. protected:
  37. friend class SceneObject;
  38. /** @copydoc CCollider::createInternal */
  39. SPtr<Collider> createInternal() override;
  40. protected:
  41. float mRadius;
  42. /************************************************************************/
  43. /* RTTI */
  44. /************************************************************************/
  45. public:
  46. friend class CSphereColliderRTTI;
  47. static RTTITypeBase* getRTTIStatic();
  48. RTTITypeBase* getRTTI() const override;
  49. protected:
  50. CSphereCollider() {} // Serialization only
  51. };
  52. /** @} */
  53. }