BsFCollider.h 2.4 KB

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