BsCPlaneCollider.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. /** @name Internal
  30. * @{
  31. */
  32. /** Returns the plane collider that this component wraps. */
  33. PlaneCollider* _getInternal() const { return static_cast<PlaneCollider*>(mInternal.get()); }
  34. /** @} */
  35. /************************************************************************/
  36. /* COMPONENT OVERRIDES */
  37. /************************************************************************/
  38. protected:
  39. friend class SceneObject;
  40. /** @copydoc CCollider::createInternal */
  41. SPtr<Collider> createInternal() override;
  42. /** @copydoc CCollider::isValidParent */
  43. bool isValidParent(const HRigidbody& parent) const override;
  44. protected:
  45. Vector3 mNormal = Vector3::UNIT_X;
  46. float mDistance = 0.0f;
  47. /************************************************************************/
  48. /* RTTI */
  49. /************************************************************************/
  50. public:
  51. friend class CPlaneColliderRTTI;
  52. static RTTITypeBase* getRTTIStatic();
  53. RTTITypeBase* getRTTI() const override;
  54. protected:
  55. CPlaneCollider() {} // Serialization only
  56. };
  57. /** @} */
  58. }