1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
---|---|
2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
3 | #include "BsPhysXPlaneCollider.h" |
4 | #include "BsPhysX.h" |
5 | #include "PxPhysics.h" |
6 | #include "BsFPhysXCollider.h" |
7 | |
8 | using namespace physx; |
9 | |
10 | namespace bs |
11 | { |
12 | PhysXPlaneCollider::PhysXPlaneCollider(PxPhysics* physx, PxScene* scene, const Vector3& position, |
13 | const Quaternion& rotation) |
14 | { |
15 | PxPlaneGeometry geometry; |
16 | |
17 | PxShape* shape = physx->createShape(geometry, *gPhysX().getDefaultMaterial(), true); |
18 | shape->setLocalPose(toPxTransform(position, rotation)); |
19 | shape->userData = this; |
20 | |
21 | mInternal = bs_new<FPhysXCollider>(scene, shape); |
22 | } |
23 | |
24 | PhysXPlaneCollider::~PhysXPlaneCollider() |
25 | { |
26 | bs_delete(mInternal); |
27 | } |
28 | |
29 | FPhysXCollider* PhysXPlaneCollider::getInternal() const |
30 | { |
31 | return static_cast<FPhysXCollider*>(mInternal); |
32 | } |
33 | } |