BsCPlaneCollider.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 "BsPlaneCollider.h"
  6. #include "BsCCollider.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Components-Core
  10. * @{
  11. */
  12. /**
  13. * @copydoc PlaneCollider
  14. *
  15. * Wraps PlaneCollider as a Component.
  16. */
  17. class BS_CORE_EXPORT CPlaneCollider : public CCollider
  18. {
  19. public:
  20. CPlaneCollider(const HSceneObject& parent);
  21. /** Sets the normal vector of the plane. It determines how is the plane oriented. */
  22. void setNormal(const Vector3& normal);
  23. /** Gets the normal vector of the plane. It determines how is the plane oriented. */
  24. Vector3 getNormal() const { return mNormal; }
  25. /** Sets the distance of the plane from the local origin, along its normal vector. */
  26. void setDistance(float distance);
  27. /** Gets the distance of the plane from the local origin, along its normal vector. */
  28. float getDistance() const { return mDistance; }
  29. /** Returns the plane collider that this component wraps. */
  30. SPtr<PlaneCollider> _getInternal() const { return std::static_pointer_cast<PlaneCollider>(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 mNormal = Vector3::UNIT_Y;
  40. float mDistance = 0.0f;
  41. /************************************************************************/
  42. /* RTTI */
  43. /************************************************************************/
  44. public:
  45. friend class CPlaneColliderRTTI;
  46. static RTTITypeBase* getRTTIStatic();
  47. RTTITypeBase* getRTTI() const override;
  48. protected:
  49. CPlaneCollider() {} // Serialization only
  50. };
  51. /** @} */
  52. }