Exposing BulletShape.getBounds
This commit is contained in:
parent
3d19752dc0
commit
aaca66cdc1
|
|
@ -73,3 +73,31 @@ set_local_scale(const LVecBase3 &scale) {
|
|||
ptr()->setLocalScaling(LVecBase3_to_btVector3(scale));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletShape::get_bounds
|
||||
// Access: Published
|
||||
// Description: Returns the current bounds of this collision shape.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
BoundingSphere BulletShape::
|
||||
get_bounds() const {
|
||||
|
||||
/*
|
||||
btTransform tr;
|
||||
tr.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
ptr()->getAabb(tr,aabbMin,aabbMax);
|
||||
btVector3 o = tr.getOrigin();
|
||||
cout << "aabbMin " << aabbMin.x() << " " << aabbMin.y() << " " << aabbMin.z() << endl;
|
||||
cout << "aabbMax " << aabbMax.x() << " " << aabbMax.y() << " " << aabbMax.z() << endl;
|
||||
cout << "origin " << aabbMin.x() << " " << aabbMin.y() << " " << aabbMin.z() << endl;
|
||||
*/
|
||||
|
||||
btVector3 center;
|
||||
btScalar radius;
|
||||
|
||||
ptr()->getBoundingSphere(center, radius);
|
||||
BoundingSphere bounds(btVector3_to_LPoint3(center), (PN_stdfloat)radius);
|
||||
|
||||
return bounds;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "bullet_includes.h"
|
||||
|
||||
#include "typedReferenceCount.h"
|
||||
#include "boundingSphere.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : BulletShape
|
||||
|
|
@ -43,6 +44,8 @@ PUBLISHED:
|
|||
|
||||
PN_stdfloat get_margin() const;
|
||||
|
||||
BoundingSphere get_bounds() const;
|
||||
|
||||
public:
|
||||
virtual btCollisionShape *ptr() const = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue