diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-13 08:54:12 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-13 08:54:12 +0400 |
commit | 956d120098f4c9f6440266e6e95800d76c782827 (patch) | |
tree | 22529b99a96ad58daa00d17067d138ed3364cfb4 /source/gameengine/Physics | |
parent | 1b73d3ce058a0edbbdfcc573d0084f655a9c8465 (diff) |
Bullet integration uninitialised values.
Erwin, r16812 "Add Fh/Rot Fh to Bullet" - added this function
ClosestRayResultCallbackNotMe(rayFromWorld,rayToWorld,body,parentBody)
...but parentBody was being ignored and the m_parent value wasn't being initialized.
Run memset() on CcdConstructionInfo which had some unset members for CreateSphereController() and CreateConeController().
Diffstat (limited to 'source/gameengine/Physics')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index cef2f2477b7..faf1ca42766 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -660,9 +660,10 @@ class ClosestRayResultCallbackNotMe : public btCollisionWorld::ClosestRayResultC public: ClosestRayResultCallbackNotMe(const btVector3& rayFromWorld,const btVector3& rayToWorld,btCollisionObject* owner,btCollisionObject* parent) :btCollisionWorld::ClosestRayResultCallback(rayFromWorld,rayToWorld), - m_owner(owner) + m_owner(owner), + m_parent(parent) { - + } virtual bool needsCollision(btBroadphaseProxy* proxy0) const @@ -710,7 +711,7 @@ void CcdPhysicsEnvironment::processFhSprings(double curTime,float timeStep) //btVector3 rayToWorld = rayFromWorld + body->getCenterOfMassTransform().getBasis() * rayDirLocal; //ray always points down the z axis in world space... btVector3 rayToWorld = rayFromWorld + rayDirLocal; - + ClosestRayResultCallbackNotMe resultCallback(rayFromWorld,rayToWorld,body,parentBody); m_dynamicsWorld->rayTest(rayFromWorld,rayToWorld,resultCallback); @@ -1558,8 +1559,8 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radi { CcdConstructionInfo cinfo; - // memory leak! The shape is not deleted by Bullet and we cannot add it to the KX_Scene.m_shapes list - cinfo.m_collisionShape = new btSphereShape(radius); + memset(&cinfo, 0, sizeof(cinfo)); /* avoid uninitialized values */ + cinfo.m_collisionShape = new btSphereShape(radius); // memory leak! The shape is not deleted by Bullet and we cannot add it to the KX_Scene.m_shapes list cinfo.m_MotionState = 0; cinfo.m_physicsEnv = this; // declare this object as Dyamic rather then static!! @@ -2018,7 +2019,7 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float coneradius,float coneheight) { CcdConstructionInfo cinfo; - + memset(&cinfo, 0, sizeof(cinfo)); /* avoid uninitialized values */ // we don't need a CcdShapeConstructionInfo for this shape: // it is simple enough for the standard copy constructor (see CcdPhysicsController::GetReplica) cinfo.m_collisionShape = new btConeShape(coneradius,coneheight); |