Adding helper method for tracking dirty state of BulletRigidBodyNodes.

This commit is contained in:
enn0x 2013-01-31 11:51:47 +00:00
parent ef0545ba41
commit 8848966298
2 changed files with 34 additions and 0 deletions

View File

@ -513,6 +513,7 @@ MotionState() {
_scale = LVecBase3(1.0f, 1.0f, 1.0f);
_disabled = false;
_dirty = false;
_was_dirty = false;
}
////////////////////////////////////////////////////////////////////
@ -536,6 +537,7 @@ setWorldTransform(const btTransform &trans) {
_trans = trans;
_dirty = true;
_was_dirty = true;
}
////////////////////////////////////////////////////////////////////
@ -596,3 +598,29 @@ sync_disabled() const {
return _disabled;
}
////////////////////////////////////////////////////////////////////
// Function: BulletRigidBodyNode::MotionState::pick_dirty_flag
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
bool BulletRigidBodyNode::MotionState::
pick_dirty_flag() {
bool flag = _was_dirty;
_was_dirty = false;
return flag;
}
////////////////////////////////////////////////////////////////////
// Function: BulletRigidBodyNode::pick_dirty_flag
// Access: Published
// Description: Returns TRUE if the transform of the rigid body
// has changed at least once since the last call to
// this method.
////////////////////////////////////////////////////////////////////
bool BulletRigidBodyNode::
pick_dirty_flag() {
return _motion->pick_dirty_flag();
}

View File

@ -77,6 +77,9 @@ PUBLISHED:
void set_linear_factor(const LVector3 &factor);
void set_angular_factor(const LVector3 &factor);
// Special
bool pick_dirty_flag();
public:
virtual btCollisionObject *get_object() const;
@ -107,11 +110,14 @@ private:
void sync_b2p(PandaNode *node);
bool sync_disabled() const;
bool pick_dirty_flag();
private:
btTransform _trans;
LVecBase3 _scale;
bool _disabled;
bool _dirty;
bool _was_dirty;
};
MotionState *_motion;