diff --git a/panda/src/bullet/bulletCharacterControllerNode.cxx b/panda/src/bullet/bulletCharacterControllerNode.cxx index a1acbe3a8c..c42977c32e 100644 --- a/panda/src/bullet/bulletCharacterControllerNode.cxx +++ b/panda/src/bullet/bulletCharacterControllerNode.cxx @@ -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; } diff --git a/panda/src/bullet/bulletGhostNode.cxx b/panda/src/bullet/bulletGhostNode.cxx index 8b3f147944..f2a2c5bea5 100644 --- a/panda/src/bullet/bulletGhostNode.cxx +++ b/panda/src/bullet/bulletGhostNode.cxx @@ -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 diff --git a/panda/src/bullet/bulletGhostNode.h b/panda/src/bullet/bulletGhostNode.h index 5a91478448..2c0f5731af 100644 --- a/panda/src/bullet/bulletGhostNode.h +++ b/panda/src/bullet/bulletGhostNode.h @@ -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;