BsFCollider.h 2.7 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 "BsPhysicsCommon.h"
  6. #include "BsVector3.h"
  7. #include "BsQuaternion.h"
  8. namespace BansheeEngine
  9. {
  10. class BS_CORE_EXPORT FCollider
  11. {
  12. public:
  13. virtual ~FCollider();
  14. virtual Vector3 getPosition() const = 0;
  15. virtual Quaternion getRotation() const = 0;
  16. virtual void setTransform(const Vector3& pos, const Quaternion& rotation) = 0;
  17. virtual void setIsTrigger(bool value) = 0;
  18. virtual bool getIsTrigger() const = 0;
  19. virtual void setIsStatic(bool value) = 0;
  20. virtual bool getIsStatic() const = 0;
  21. // Not used for triggers, only relevant if parent rigidbody uses child mass
  22. virtual void setMass(float mass) { mMass = mass; }
  23. virtual float getMass() const { return mMass; }
  24. virtual void setMaterial(const HPhysicsMaterial& material);
  25. virtual HPhysicsMaterial getMaterial() const { return mMaterial; }
  26. /**
  27. * Determines how far apart do two shapes need to be away from each other before the physics runtime starts
  28. * generating repelling impulse for them. This distance will be the sum of contact offsets of the two interacting
  29. * objects. If objects are moving fast you can increase this value to start generating the impulse earlier and
  30. * potentially prevent the objects from interpenetrating. This value is in meters.
  31. *
  32. * Also see setRestOffset().
  33. */
  34. virtual void setContactOffset(float value) = 0;
  35. /** Returns shape's contact offset in meters. See setContactOffset() to learn contact offset is. */
  36. virtual float getContactOffset() const = 0;
  37. /**
  38. * Sets at what distance should two objects resting on one another come to an equilibrium. The value used in the
  39. * runtime will be the sum of rest offsets for both interacting objects. This value is in meters.
  40. */
  41. virtual void setRestOffset(float value) = 0;
  42. /** Returns shepe's rest offset in meters. See setRestOffset() to learn what contact offset is. */
  43. virtual float getRestOffset() const = 0;
  44. virtual void setLayer(UINT64 layer) = 0;
  45. virtual UINT64 getLayer() const = 0;
  46. virtual void setCollisionReportMode(CollisionReportMode mode) = 0;
  47. virtual CollisionReportMode getCollisionReportMode() const = 0;
  48. /** Enables continous collision detect for this collider. Only valid if the collider is a part of a rigidbody. */
  49. virtual void _setCCD(bool enabled) = 0;
  50. protected:
  51. float mMass = 1.0f;
  52. HPhysicsMaterial mMaterial;
  53. };
  54. }