(Perhaps) fixing BulletContact crashes on Linux

This commit is contained in:
enn0x 2012-02-27 22:46:42 +00:00
parent 2976ec052e
commit 4546fb9e77
7 changed files with 34 additions and 10 deletions

View File

@ -76,6 +76,8 @@ class btTypedObject;
class btVector3; class btVector3;
class btVehicleRaycaster; class btVehicleRaycaster;
template <typename T> class btAlignedObjectArray;
class btWheelInfo { class btWheelInfo {
public: public:
class RaycastInfo; class RaycastInfo;

View File

@ -43,7 +43,7 @@ get_node1() const {
INLINE const BulletManifoldPoint *BulletContact:: INLINE const BulletManifoldPoint *BulletContact::
get_manifold_point() const { get_manifold_point() const {
return new BulletManifoldPoint(*_mp); return new BulletManifoldPoint(_mp);
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -36,10 +36,9 @@ addSingleResult(btManifoldPoint &mp,
const btCollisionObject *obj0, int part_id0, int idx0, const btCollisionObject *obj0, int part_id0, int idx0,
const btCollisionObject *obj1, int part_id1, int idx1) { const btCollisionObject *obj1, int part_id1, int idx1) {
BulletContact contact; BulletContact contact;
contact._mp = &mp; contact._mp = mp;
contact._obj0 = obj0; contact._obj0 = obj0;
contact._obj1 = obj1; contact._obj1 = obj1;
contact._part_id0 = part_id0; contact._part_id0 = part_id0;

View File

@ -38,7 +38,7 @@ PUBLISHED:
INLINE const int get_part_id1() const; INLINE const int get_part_id1() const;
private: private:
btManifoldPoint *_mp; btManifoldPoint _mp;
const btCollisionObject *_obj0; const btCollisionObject *_obj0;
const btCollisionObject *_obj1; const btCollisionObject *_obj1;
int _part_id0; int _part_id0;
@ -71,7 +71,7 @@ protected:
private: private:
static BulletContact _empty; static BulletContact _empty;
pvector<BulletContact> _contacts; btAlignedObjectArray<BulletContact> _contacts;
friend class BulletWorld; friend class BulletWorld;
}; };

View File

@ -20,7 +20,7 @@
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
BulletManifoldPoint:: BulletManifoldPoint::
BulletManifoldPoint(btManifoldPoint &pt) : _pt(pt) { BulletManifoldPoint(const btManifoldPoint &pt) : _pt(pt) {
} }
@ -30,7 +30,7 @@ BulletManifoldPoint(btManifoldPoint &pt) : _pt(pt) {
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
int BulletManifoldPoint:: int BulletManifoldPoint::
get_lift_time() const { get_life_time() const {
return _pt.getLifeTime(); return _pt.getLifeTime();
} }

View File

@ -31,7 +31,7 @@ class EXPCL_PANDABULLET BulletManifoldPoint {
PUBLISHED: PUBLISHED:
INLINE ~BulletManifoldPoint(); INLINE ~BulletManifoldPoint();
int get_lift_time() const; int get_life_time() const;
PN_stdfloat get_distance() const; PN_stdfloat get_distance() const;
PN_stdfloat get_applied_impulse() const; PN_stdfloat get_applied_impulse() const;
LPoint3 get_position_world_on_a() const; LPoint3 get_position_world_on_a() const;
@ -45,10 +45,10 @@ PUBLISHED:
int get_index1() const; int get_index1() const;
public: public:
BulletManifoldPoint(btManifoldPoint &pt); BulletManifoldPoint(const btManifoldPoint &pt);
private: private:
btManifoldPoint &_pt; const btManifoldPoint _pt;
}; };
#include "bulletManifoldPoint.I" #include "bulletManifoldPoint.I"

View File

@ -64,6 +64,29 @@ BulletWorld() {
// Dispatcher // Dispatcher
_dispatcher = new btCollisionDispatcher(_configuration); _dispatcher = new btCollisionDispatcher(_configuration);
/*
_dispatcher.registerCollisionCreateFunc(
BroadphaseNativeType.ConvexTriangleMeshShape,
BroadphaseNativeType.ConvexTriangleMeshShape,
dcc.GetCollisionAlgorithmCreateFunc(
BroadphaseNativeType.TriangleMeshShape,
BroadphaseNativeType.TriangleMeshShape));
_dispatcher.registerCollisionCreateFunc(
BroadphaseNativeType.TriangleMeshShape,
BroadphaseNativeType.TriangleMeshShape,
dcc.GetCollisionAlgorithmCreateFunc(
BroadphaseNativeType.ConvexTriangleMeshShape,
BroadphaseNativeType.ConvexTriangleMeshShape));
_dispatcher.registerCollisionCreateFunc(
BroadphaseNativeType.ConvexTriangleMeshShape,
BroadphaseNativeType.ConvexTriangleMeshShape,
dcc.GetCollisionAlgorithmCreateFunc(
BroadphaseNativeType.ConvexTriangleMeshShape,
BroadphaseNativeType.ConvexTriangleMeshShape));
*/
// Solver // Solver
_solver = new btSequentialImpulseConstraintSolver; _solver = new btSequentialImpulseConstraintSolver;