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:
@@ -26,6 +26,7 @@ btCollisionObject::btCollisionObject()
|
|||||||
m_deactivationTime(btScalar(0.)),
|
m_deactivationTime(btScalar(0.)),
|
||||||
m_friction(btScalar(0.5)),
|
m_friction(btScalar(0.5)),
|
||||||
m_restitution(btScalar(0.)),
|
m_restitution(btScalar(0.)),
|
||||||
|
m_objectName (0),
|
||||||
m_userObjectPointer(0),
|
m_userObjectPointer(0),
|
||||||
m_internalOwner(0),
|
m_internalOwner(0),
|
||||||
m_hitFraction(btScalar(1.)),
|
m_hitFraction(btScalar(1.)),
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ protected:
|
|||||||
///m_internalOwner is reserved to point to Bullet's btRigidBody. Don't use this, use m_userObjectPointer instead.
|
///m_internalOwner is reserved to point to Bullet's btRigidBody. Don't use this, use m_userObjectPointer instead.
|
||||||
void* m_internalOwner;
|
void* m_internalOwner;
|
||||||
|
|
||||||
|
// setName, getName
|
||||||
|
char* m_objectName;
|
||||||
|
|
||||||
///time of impact calculation
|
///time of impact calculation
|
||||||
btScalar m_hitFraction;
|
btScalar m_hitFraction;
|
||||||
|
|
||||||
@@ -334,6 +337,18 @@ public:
|
|||||||
m_userObjectPointer = userPointer;
|
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)
|
inline bool checkCollideWith(btCollisionObject* co)
|
||||||
{
|
{
|
||||||
if (m_checkCollideWith)
|
if (m_checkCollideWith)
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ class btCollisionShape
|
|||||||
{
|
{
|
||||||
|
|
||||||
void* m_userPointer;
|
void* m_userPointer;
|
||||||
|
char* m_shapeName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
btCollisionShape() : m_userPointer(0)
|
btCollisionShape() : m_userPointer(0), m_shapeName (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~btCollisionShape()
|
virtual ~btCollisionShape()
|
||||||
@@ -103,7 +104,16 @@ public:
|
|||||||
return m_userPointer;
|
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
|
#endif //COLLISION_SHAPE_H
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class btTypedConstraint
|
|||||||
{
|
{
|
||||||
int m_userConstraintType;
|
int m_userConstraintType;
|
||||||
int m_userConstraintId;
|
int m_userConstraintId;
|
||||||
|
char* m_name;
|
||||||
|
|
||||||
btTypedConstraintType m_constraintType;
|
btTypedConstraintType m_constraintType;
|
||||||
|
|
||||||
@@ -107,6 +108,16 @@ public:
|
|||||||
{
|
{
|
||||||
return m_constraintType;
|
return m_constraintType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* getName () const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setName (char* name)
|
||||||
|
{
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //TYPED_CONSTRAINT_H
|
#endif //TYPED_CONSTRAINT_H
|
||||||
|
|||||||
@@ -391,6 +391,11 @@ void btDiscreteDynamicsWorld::setGravity(const btVector3& gravity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btVector3 btDiscreteDynamicsWorld::getGravity () const
|
||||||
|
{
|
||||||
|
return m_gravity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void btDiscreteDynamicsWorld::removeRigidBody(btRigidBody* body)
|
void btDiscreteDynamicsWorld::removeRigidBody(btRigidBody* body)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual void setGravity(const btVector3& gravity);
|
virtual void setGravity(const btVector3& gravity);
|
||||||
|
virtual btVector3 getGravity () const;
|
||||||
|
|
||||||
virtual void addRigidBody(btRigidBody* body);
|
virtual void addRigidBody(btRigidBody* body);
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class btDynamicsWorld : public btCollisionWorld
|
|||||||
//once a rigidbody is added to the dynamics world, it will get this gravity assigned
|
//once a rigidbody is added to the dynamics world, it will get this gravity assigned
|
||||||
//existing rigidbodies in the world get gravity assigned too, during this method
|
//existing rigidbodies in the world get gravity assigned too, during this method
|
||||||
virtual void setGravity(const btVector3& gravity) = 0;
|
virtual void setGravity(const btVector3& gravity) = 0;
|
||||||
|
virtual btVector3 getGravity () const = 0;
|
||||||
|
|
||||||
virtual void addRigidBody(btRigidBody* body) = 0;
|
virtual void addRigidBody(btRigidBody* body) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -449,7 +449,6 @@ public:
|
|||||||
return m_constraintRefs.size();
|
return m_constraintRefs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int m_debugBodyId;
|
int m_debugBodyId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,11 @@ void btSimpleDynamicsWorld::setGravity(const btVector3& gravity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btVector3 btSimpleDynamicsWorld::getGravity () const
|
||||||
|
{
|
||||||
|
return m_gravity;
|
||||||
|
}
|
||||||
|
|
||||||
void btSimpleDynamicsWorld::removeRigidBody(btRigidBody* body)
|
void btSimpleDynamicsWorld::removeRigidBody(btRigidBody* body)
|
||||||
{
|
{
|
||||||
removeCollisionObject(body);
|
removeCollisionObject(body);
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ public:
|
|||||||
|
|
||||||
virtual void setGravity(const btVector3& gravity);
|
virtual void setGravity(const btVector3& gravity);
|
||||||
|
|
||||||
|
virtual btVector3 getGravity () const;
|
||||||
|
|
||||||
virtual void addRigidBody(btRigidBody* body);
|
virtual void addRigidBody(btRigidBody* body);
|
||||||
|
|
||||||
virtual void removeRigidBody(btRigidBody* body);
|
virtual void removeRigidBody(btRigidBody* body);
|
||||||
|
|||||||
Reference in New Issue
Block a user