mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
Switch from setVelocityForTimeInterval to setWalkDirection.
This commit is contained in:
parent
0c2ab823d3
commit
212ed1e510
@ -227,7 +227,8 @@ sync_p2b(float dt) {
|
|||||||
v = LVecBase3f_to_btVector3(_linear_velocity);
|
v = LVecBase3f_to_btVector3(_linear_velocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
_character->setVelocityForTimeInterval(v, dt);
|
//_character->setVelocityForTimeInterval(v, dt);
|
||||||
|
_character->setWalkDirection(v * dt);
|
||||||
_angular_velocity = 0.0f;
|
_angular_velocity = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ BulletGhostNode(const char *name) : BulletBodyNode(name) {
|
|||||||
// Synchronised transform
|
// Synchronised transform
|
||||||
_sync = TransformState::make_identity();
|
_sync = TransformState::make_identity();
|
||||||
_sync_disable = false;
|
_sync_disable = false;
|
||||||
|
_sync_local = false;
|
||||||
|
|
||||||
// Initial transform
|
// Initial transform
|
||||||
btTransform trans = btTransform::getIdentity();
|
btTransform trans = btTransform::getIdentity();
|
||||||
@ -52,6 +53,32 @@ get_object() const {
|
|||||||
return _ghost;
|
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
|
// Function: BulletGhostNode::transform_changed
|
||||||
// Access: Protected
|
// Access: Protected
|
||||||
|
@ -48,11 +48,13 @@ public:
|
|||||||
void sync_b2p();
|
void sync_b2p();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void parents_changed();
|
||||||
virtual void transform_changed();
|
virtual void transform_changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CPT(TransformState) _sync;
|
CPT(TransformState) _sync;
|
||||||
bool _sync_disable;
|
bool _sync_disable;
|
||||||
|
bool _sync_local;
|
||||||
|
|
||||||
btPairCachingGhostObject *_ghost;
|
btPairCachingGhostObject *_ghost;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user