BsFPhysXCollider.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsPhysXPrerequisites.h"
  5. #include "BsCollision.h"
  6. #include "BsFCollider.h"
  7. #include "PxRigidStatic.h"
  8. namespace BansheeEngine
  9. {
  10. class FPhysXCollider : public FCollider
  11. {
  12. public:
  13. explicit FPhysXCollider(physx::PxShape* shape);
  14. ~FPhysXCollider();
  15. Vector3 getPosition() const override;
  16. Quaternion getRotation() const override;
  17. void setTransform(const Vector3& pos, const Quaternion& rotation) override;
  18. void setIsTrigger(bool value) override;
  19. bool getIsTrigger() const override;
  20. void setMass(float mass) override;
  21. /**
  22. * Determines how far apart do two shapes need to be away from each other before the physics runtime starts
  23. * generating repelling impulse for them. This distance will be the sum of contact offsets of the two interacting
  24. * objects. If objects are moving fast you can increase this value to start generating the impulse earlier and
  25. * potentially prevent the objects from interpenetrating. This value is in meters.
  26. *
  27. * Also see setRestOffset().
  28. */
  29. void setContactOffset(float value) override;
  30. /** Returns shape's contact offset in meters. See setContactOffset() to learn contact offset is. */
  31. float getContactOffset() const override;
  32. /**
  33. * Sets at what distance should two objects resting on one another come to an equilibrium. The value used in the
  34. * runtime will be the sum of rest offsets for both interacting objects. This value is in meters.
  35. */
  36. void setRestOffset(float value) override;
  37. /** Returns shepe's rest offset in meters. See setRestOffset() to learn what contact offset is. */
  38. float getRestOffset() const override;
  39. void setRigidbody(const SPtr<Rigidbody>& rigidbody) override;
  40. void setMaterial(const HPhysicsMaterial& material) override;
  41. void setLayer(UINT64 layer) override;
  42. physx::PxShape* _getShape() const { return mShape; }
  43. protected:
  44. physx::PxShape* mShape;
  45. physx::PxRigidStatic* mStaticBody;
  46. bool mIsTrigger;
  47. };
  48. }