Switch from setVelocityForTimeInterval to setWalkDirection.

This commit is contained in:
enn0x 2011-09-07 21:54:44 +00:00
parent 0c2ab823d3
commit 212ed1e510
3 changed files with 31 additions and 1 deletions

View File

@ -227,7 +227,8 @@ sync_p2b(float dt) {
v = LVecBase3f_to_btVector3(_linear_velocity);
}
_character->setVelocityForTimeInterval(v, dt);
//_character->setVelocityForTimeInterval(v, dt);
_character->setWalkDirection(v * dt);
_angular_velocity = 0.0f;
}

View File

@ -28,6 +28,7 @@ BulletGhostNode(const char *name) : BulletBodyNode(name) {
// Synchronised transform
_sync = TransformState::make_identity();
_sync_disable = false;
_sync_local = false;
// Initial transform
btTransform trans = btTransform::getIdentity();
@ -52,6 +53,32 @@ get_object() const {
return _ghost;
}
////////////////////////////////////////////////////////////////////
// Function: BulletGhostNode::parents_changed
// Access: Protected
// Description:
////////////////////////////////////////////////////////////////////
void BulletGhostNode::
parents_changed() {
Parents parents = get_parents();
for (int i=0; i < parents.get_num_parents(); ++i) {
PandaNode *parent = parents.get_parent(i);
TypeHandle type = parent->get_type();
if (BulletRigidBodyNode::get_class_type() == type ||
BulletSoftBodyNode::get_class_type() == type ||
BulletGhostNode::get_class_type() == type ||
BulletCharacterControllerNode::get_class_type() == type) {
_sync_local = true;
return;
}
}
_sync_local = false;
}
////////////////////////////////////////////////////////////////////
// Function: BulletGhostNode::transform_changed
// Access: Protected

View File

@ -48,11 +48,13 @@ public:
void sync_b2p();
protected:
virtual void parents_changed();
virtual void transform_changed();
private:
CPT(TransformState) _sync;
bool _sync_disable;
bool _sync_local;
btPairCachingGhostObject *_ghost;