BsCPlaneCollider.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. /** @cond INTERNAL */
  30. /** Returns the plane collider that this component wraps. */
  31. PlaneCollider* _getInternal() const { return static_cast<PlaneCollider*>(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. /** @copydoc CPlaneCollider::isValidParent */
  41. bool isValidParent(const HRigidbody& parent) const override;
  42. protected:
  43. Vector3 mNormal = Vector3::UNIT_X;
  44. float mDistance = 0.0f;
  45. /************************************************************************/
  46. /* RTTI */
  47. /************************************************************************/
  48. public:
  49. friend class CPlaneColliderRTTI;
  50. static RTTITypeBase* getRTTIStatic();
  51. RTTITypeBase* getRTTI() const override;
  52. protected:
  53. CPlaneCollider() {} // Serialization only
  54. };
  55. /** @} */
  56. }