Added name fields to Collision Object and Shape.

Added name field to Typed Constraint.
Added accessor for gravity in dynamics world.
This commit is contained in:
johnmccutchan
2008-01-30 01:52:07 +00:00
parent 5c40e615bd
commit 8fff5c54e9
10 changed files with 52 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ btCollisionObject::btCollisionObject()
m_deactivationTime(btScalar(0.)),
m_friction(btScalar(0.5)),
m_restitution(btScalar(0.)),
m_objectName (0),
m_userObjectPointer(0),
m_internalOwner(0),
m_hitFraction(btScalar(1.)),

View File

@@ -69,6 +69,9 @@ protected:
///m_internalOwner is reserved to point to Bullet's btRigidBody. Don't use this, use m_userObjectPointer instead.
void* m_internalOwner;
// setName, getName
char* m_objectName;
///time of impact calculation
btScalar m_hitFraction;
@@ -334,6 +337,18 @@ public:
m_userObjectPointer = userPointer;
}
char* getName () const
{
return m_objectName;
}
/// the user is responsible for the memory management of name
void setName (char* name)
{
m_objectName = name;
}
inline bool checkCollideWith(btCollisionObject* co)
{
if (m_checkCollideWith)

View File

@@ -27,10 +27,11 @@ class btCollisionShape
{
void* m_userPointer;
char* m_shapeName;
public:
btCollisionShape() : m_userPointer(0)
btCollisionShape() : m_userPointer(0), m_shapeName (0)
{
}
virtual ~btCollisionShape()
@@ -103,7 +104,16 @@ public:
return m_userPointer;
}
char* getShapeName () const
{
return m_shapeName;
}
/// the user is responsible for the memory management of name
void setShapeName (char* name)
{
m_shapeName = name;
}
};
#endif //COLLISION_SHAPE_H