mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
bullet: support Plane class in BulletPlaneShape
This commit is contained in:
parent
cf451bde23
commit
eda47c7f3b
@ -15,6 +15,18 @@
|
|||||||
|
|
||||||
TypeHandle BulletPlaneShape::_type_handle;
|
TypeHandle BulletPlaneShape::_type_handle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a plane shape from a plane definition.
|
||||||
|
*/
|
||||||
|
BulletPlaneShape::
|
||||||
|
BulletPlaneShape(LPlane plane) {
|
||||||
|
|
||||||
|
btVector3 btNormal = LVecBase3_to_btVector3(plane.get_normal());
|
||||||
|
|
||||||
|
_shape = new btStaticPlaneShape(btNormal, plane.get_w());
|
||||||
|
_shape->setUserPointer(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -50,6 +62,17 @@ ptr() const {
|
|||||||
return _shape;
|
return _shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
LPlane BulletPlaneShape::
|
||||||
|
get_plane() const {
|
||||||
|
LightMutexHolder holder(BulletWorld::get_global_lock());
|
||||||
|
|
||||||
|
btVector3 normal = _shape->getPlaneNormal();
|
||||||
|
return LPlane(normal[0], normal[1], normal[2], (PN_stdfloat)_shape->getPlaneConstant());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -32,15 +32,18 @@ private:
|
|||||||
INLINE BulletPlaneShape() : _shape(nullptr) {};
|
INLINE BulletPlaneShape() : _shape(nullptr) {};
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
|
explicit BulletPlaneShape(LPlane plane);
|
||||||
explicit BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant);
|
explicit BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant);
|
||||||
BulletPlaneShape(const BulletPlaneShape ©);
|
BulletPlaneShape(const BulletPlaneShape ©);
|
||||||
INLINE ~BulletPlaneShape();
|
INLINE ~BulletPlaneShape();
|
||||||
|
|
||||||
|
LPlane get_plane() const;
|
||||||
LVector3 get_plane_normal() const;
|
LVector3 get_plane_normal() const;
|
||||||
PN_stdfloat get_plane_constant() const;
|
PN_stdfloat get_plane_constant() const;
|
||||||
|
|
||||||
static BulletPlaneShape *make_from_solid(const CollisionPlane *solid);
|
static BulletPlaneShape *make_from_solid(const CollisionPlane *solid);
|
||||||
|
|
||||||
|
MAKE_PROPERTY(plane, get_plane);
|
||||||
MAKE_PROPERTY(plane_normal, get_plane_normal);
|
MAKE_PROPERTY(plane_normal, get_plane_normal);
|
||||||
MAKE_PROPERTY(plane_constant, get_plane_constant);
|
MAKE_PROPERTY(plane_constant, get_plane_constant);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user