BsCPlaneCollider.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 "Physics/BsPlaneCollider.h"
  6. #include "Components/BsCCollider.h"
  7. namespace bs
  8. {
  9. /** @addtogroup Components-Core
  10. * @{
  11. */
  12. /**
  13. * @copydoc PlaneCollider
  14. *
  15. * @note Wraps PlaneCollider as a Component.
  16. */
  17. class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Physics,n:PlaneCollider) CPlaneCollider : public CCollider
  18. {
  19. public:
  20. CPlaneCollider(const HSceneObject& parent);
  21. /** Normal vector that determines the local orientation of the plane. */
  22. BS_SCRIPT_EXPORT(n:Normal,pr:setter)
  23. void setNormal(const Vector3& normal);
  24. /** @copydoc setNormal() */
  25. BS_SCRIPT_EXPORT(n:Normal,pr:getter)
  26. Vector3 getNormal() const { return mNormal; }
  27. /** Determines the distance of the plane from the local origin, along its normal vector. */
  28. BS_SCRIPT_EXPORT(n:Distance,pr:setter)
  29. void setDistance(float distance);
  30. /** @copydoc setDistance() */
  31. BS_SCRIPT_EXPORT(n:Distance,pr:getter)
  32. float getDistance() const { return mDistance; }
  33. /** @name Internal
  34. * @{
  35. */
  36. /** Returns the plane collider that this component wraps. */
  37. PlaneCollider* _getInternal() const { return static_cast<PlaneCollider*>(mInternal.get()); }
  38. /** @} */
  39. /************************************************************************/
  40. /* COMPONENT OVERRIDES */
  41. /************************************************************************/
  42. protected:
  43. friend class SceneObject;
  44. /** @copydoc CCollider::createInternal */
  45. SPtr<Collider> createInternal() override;
  46. /** @copydoc CCollider::isValidParent */
  47. bool isValidParent(const HRigidbody& parent) const override;
  48. protected:
  49. Vector3 mNormal = Vector3::UNIT_X;
  50. float mDistance = 0.0f;
  51. /************************************************************************/
  52. /* RTTI */
  53. /************************************************************************/
  54. public:
  55. friend class CPlaneColliderRTTI;
  56. static RTTITypeBase* getRTTIStatic();
  57. RTTITypeBase* getRTTI() const override;
  58. protected:
  59. CPlaneCollider() {} // Serialization only
  60. };
  61. /** @} */
  62. }