Changeset 3361
- Timestamp:
- 02/03/10 09:42:58 (6 weeks ago)
- Location:
- plugins/branches/0185_GEN_PHYSICS_REFACTOR_2/ZBullet/src
- Files:
-
- 4 modified
-
CollisionShape.cpp (modified) (5 diffs)
-
CollisionShape.hpp (modified) (2 diffs)
-
PhysicsActor.cpp (modified) (2 diffs)
-
PhysicsZone.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/branches/0185_GEN_PHYSICS_REFACTOR_2/ZBullet/src/CollisionShape.cpp
r3292 r3361 47 47 //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 48 48 CollisionShape::CollisionShape() 49 : m_ shape(NULL)49 : m_pShape(NULL) 50 50 , m_pScriptObject(NULL) 51 51 , m_activationState(1) … … 57 57 58 58 m_name = ""; 59 m_IsNUllFlaged = false; 59 60 } 60 61 … … 62 63 CollisionShape::~CollisionShape() 63 64 { 65 if (m_pShape != NULL) delete m_pShape; 64 66 } 65 67 … … 82 84 CollisionShape::getShapePtr() 83 85 { 84 return m_ shape;86 return m_pShape; 85 87 } 86 88 … … 89 91 CollisionShape::setShapePtr(btCollisionShape* _shape) 90 92 { 91 m_ shape = _shape;93 m_pShape = _shape; 92 94 } 93 95 -
plugins/branches/0185_GEN_PHYSICS_REFACTOR_2/ZBullet/src/CollisionShape.hpp
r3349 r3361 69 69 70 70 public: 71 /// @ For Internal Newtonusage71 /// @ For Internal Bullet usage 72 72 /// @{ 73 73 btCollisionShape* getShapePtr(); 74 74 void setShapePtr(btCollisionShape* _shape); 75 void setIsNUllShape(bool _isnull){m_IsNUllFlaged = _isnull;}; 76 bool isNULLShape(){return m_IsNUllFlaged;}; 75 77 /// @} 76 78 … … 103 105 /// @{ 104 106 private: 105 btCollisionShape* m_shape;106 wpPhysicsZone_type m_pZone;107 Zen::Math::Real m_scaleX, m_scaleY, m_scaleZ;108 Scripting::I_ObjectReference* m_pScriptObject;109 std::string m_name;110 Zen::Math::Realm_minStrikeLen;111 unsigned m_activationState;112 intm_collisionGroup;113 114 pOwningObject_typem_pOwner;107 btCollisionShape* m_pShape; 108 wpPhysicsZone_type m_pZone; 109 Zen::Math::Real m_scaleX, m_scaleY, m_scaleZ; 110 Scripting::I_ObjectReference* m_pScriptObject; 111 std::string m_name; 112 Zen::Math::Real m_minStrikeLen; 113 unsigned m_activationState; 114 int m_collisionGroup; 115 bool m_IsNUllFlaged; 116 pOwningObject_type m_pOwner; 115 117 /// @} 116 118 -
plugins/branches/0185_GEN_PHYSICS_REFACTOR_2/ZBullet/src/PhysicsActor.cpp
r3353 r3361 66 66 { 67 67 if (m_MotionState != NULL) delete m_MotionState; 68 if (m_pActor != NULL) delete m_pActor; 68 69 } 69 70 … … 135 136 m_pActor = new btRigidBody(rbInfo); 136 137 m_pActor->setUserPointer(this); 137 m_pActor->setCollisionFlags(m_pActor->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK); 138 //http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=4461&hilit=btRigidBody+vs+btCollisionObject 139 //might rework this to be part of collisiongroups later 140 if (dynamic_cast<CollisionShape*>(_collision.get())->isNULLShape()) 141 { 142 m_pActor->setCollisionFlags(m_pActor->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK | btCollisionObject::CF_NO_CONTACT_RESPONSE); 143 } 144 else 145 { 146 m_pActor->setCollisionFlags(m_pActor->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK); 147 } 138 148 return true; 139 149 } -
plugins/branches/0185_GEN_PHYSICS_REFACTOR_2/ZBullet/src/PhysicsZone.cpp
r3358 r3361 71 71 PhysicsZone::~PhysicsZone() 72 72 { 73 delete m_pZone;74 delete m_pSolver;75 delete m_pDispatcher;76 delete m_pCollisionConfiguration;77 delete m_pBroadphase;73 if (m_pZone!= NULL) delete m_pZone; 74 if (m_pSolver!= NULL) delete m_pSolver; 75 if (m_pDispatcher!= NULL) delete m_pDispatcher; 76 if (m_pCollisionConfiguration!= NULL) delete m_pCollisionConfiguration; 77 if (m_pBroadphase != NULL) delete m_pBroadphase; 78 78 } 79 79 … … 312 312 CollisionShape* pRawPointer = new CollisionShape(); 313 313 pCollisionShape_type pShape(pRawPointer, boost::bind(&PhysicsZone::destroyCollisionShape, this, _1)); 314 dynamic_cast<CollisionShape*>(pShape.get())->setShapePtr(NewtonCreateNull(m_pZone)); 314 315 //bit of a hacktastic workaround, but see http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=4461&hilit=btRigidBody+vs+btCollisionObject for intent 316 pRawPointer->setShapePtr(new btSphereShape(btScalar(1.))); 317 pRawPointer->setIsNUllShape(true); 315 318 // TODO - set offsetMatrix (currently passing NULL, which centers the body at its origin) 316 319 return pShape; … … 323 326 CollisionShape* pRawPointer = new CollisionShape(); 324 327 pCollisionShape_type pShape(pRawPointer, boost::bind(&PhysicsZone::destroyCollisionShape, this, _1)); 325 dynamic_cast<CollisionShape*>(pShape.get())->setShapePtr(NewtonCreateBox(m_pZone, _dx, _dy, _dz, NULL)); 328 329 pRawPointer->setShapePtr(new btBoxShape(btVector3(_dx,_dy,_dz))); 326 330 // TODO - set offsetMatrix (currently passing NULL, which centers the body at its origin) 327 331 return pShape; … … 334 338 CollisionShape* pRawPointer = new CollisionShape(); 335 339 pCollisionShape_type pShape(pRawPointer, boost::bind(&PhysicsZone::destroyCollisionShape, this, _1)); 336 dynamic_cast<CollisionShape*>(pShape.get())->setShapePtr(NewtonCreateSphere(m_pZone, _radiusX, _radiusY, _radiusZ, NULL)); 340 341 //seem to recall something about a multisphere shape being scalable in multiple directions... research further 342 pRawPointer->setShapePtr(new btSphereShape(btScalar(_radiusX))); 337 343 // TODO - set offsetMatrix (currently passing NULL, which centers the body at its origin) 338 344 return pShape; … … 346 352 CollisionShape* pRawPointer = new CollisionShape(); 347 353 pCollisionShape_type pShape(pRawPointer, boost::bind(&PhysicsZone::destroyCollisionShape, this, _1)); 348 dynamic_cast<CollisionShape*>(pShape.get())->setShapePtr(NewtonCreateCapsule(m_pZone, _radius, _height, NULL)); 354 355 pRawPointer->setShapePtr(new btCapsuleShape(_radius, _height)); 349 356 // TODO - set offsetMatrix (currently passing NULL, which centers the body at its origin) 350 357 return pShape;
