Allow the user to attach user data to a ProxyShape object
This commit is contained in:
parent
0fa88dccfa
commit
47b2eb457a
|
@ -8,7 +8,7 @@ using namespace reactphysics3d;
|
|||
ProxyShape::ProxyShape(CollisionBody* body, CollisionShape* shape, const Transform& transform,
|
||||
decimal mass)
|
||||
:mBody(body), mCollisionShape(shape), mLocalToBodyTransform(transform), mMass(mass),
|
||||
mNext(NULL), mBroadPhaseID(-1), mCachedCollisionData(NULL) {
|
||||
mNext(NULL), mBroadPhaseID(-1), mCachedCollisionData(NULL), mUserData(NULL) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ class ProxyShape {
|
|||
/// Cached collision data
|
||||
void* mCachedCollisionData;
|
||||
|
||||
/// Pointer to user data
|
||||
void* mUserData;
|
||||
|
||||
// -------------------- Methods -------------------- //
|
||||
|
||||
/// Private copy-constructor
|
||||
|
@ -81,6 +84,12 @@ class ProxyShape {
|
|||
/// Return the mass of the collision shape
|
||||
decimal getMass() const;
|
||||
|
||||
/// Return a pointer to the user data attached to this body
|
||||
void* getUserData() const;
|
||||
|
||||
/// Attach user data to this body
|
||||
void setUserData(void* userData);
|
||||
|
||||
/// Return the local to parent body transform
|
||||
const Transform& getLocalToBodyTransform() const;
|
||||
|
||||
|
@ -121,6 +130,16 @@ inline decimal ProxyShape::getMass() const {
|
|||
return mMass;
|
||||
}
|
||||
|
||||
// Return a pointer to the user data attached to this body
|
||||
inline void* ProxyShape::getUserData() const {
|
||||
return mUserData;
|
||||
}
|
||||
|
||||
// Attach user data to this body
|
||||
inline void ProxyShape::setUserData(void* userData) {
|
||||
mUserData = userData;
|
||||
}
|
||||
|
||||
// Return the local to parent body transform
|
||||
inline const Transform& ProxyShape::getLocalToBodyTransform() const {
|
||||
return mLocalToBodyTransform;
|
||||
|
|
Loading…
Reference in New Issue
Block a user