BsPhysXPlaneCollider.cpp 700 B

123456789101112131415161718192021222324252627282930
  1. #include "BsPhysXPlaneCollider.h"
  2. #include "BsPhysX.h"
  3. #include "PxPhysics.h"
  4. #include "BsFPhysXCollider.h"
  5. using namespace physx;
  6. namespace bs
  7. {
  8. PhysXPlaneCollider::PhysXPlaneCollider(PxPhysics* physx, const Vector3& position, const Quaternion& rotation)
  9. {
  10. PxPlaneGeometry geometry;
  11. PxShape* shape = physx->createShape(geometry, *gPhysX().getDefaultMaterial(), true);
  12. shape->setLocalPose(toPxTransform(position, rotation));
  13. shape->userData = this;
  14. mInternal = bs_new<FPhysXCollider>(shape);
  15. }
  16. PhysXPlaneCollider::~PhysXPlaneCollider()
  17. {
  18. bs_delete(mInternal);
  19. }
  20. FPhysXCollider* PhysXPlaneCollider::getInternal() const
  21. {
  22. return static_cast<FPhysXCollider*>(mInternal);
  23. }
  24. }