mirror of
https://github.com/lubosz/overte.git
synced 2025-04-13 00:43:06 +02:00
eliminate angular dynamics of other-avatars
This commit is contained in:
parent
c939699879
commit
bd6f00e707
3 changed files with 14 additions and 1 deletions
|
@ -96,6 +96,10 @@ void AvatarMotionState::setWorldTransform(const btTransform& worldTrans) {
|
|||
btVector3 velocity = glmToBullet(getObjectLinearVelocity()) + (1.0f / SPRING_TIMESCALE) * offsetToTarget;
|
||||
_body->setLinearVelocity(velocity);
|
||||
_body->setAngularVelocity(glmToBullet(getObjectAngularVelocity()));
|
||||
// slam its rotation
|
||||
btTransform newTransform = worldTrans;
|
||||
newTransform.setRotation(glmToBullet(getObjectRotation()));
|
||||
_body->setWorldTransform(newTransform);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,6 +195,14 @@ void AvatarMotionState::cacheShapeDiameter() {
|
|||
}
|
||||
}
|
||||
|
||||
void AvatarMotionState::setRigidBody(btRigidBody* body) {
|
||||
ObjectMotionState::setRigidBody(body);
|
||||
if (_body) {
|
||||
// remove angular dynamics from this body
|
||||
_body->setAngularFactor(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void AvatarMotionState::setShape(const btCollisionShape* shape) {
|
||||
cacheShapeDiameter();
|
||||
ObjectMotionState::setShape(shape);
|
||||
|
|
|
@ -74,6 +74,7 @@ public:
|
|||
friend class Avatar;
|
||||
|
||||
protected:
|
||||
void setRigidBody(btRigidBody* body) override;
|
||||
void setShape(const btCollisionShape* shape) override;
|
||||
void cacheShapeDiameter();
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ protected:
|
|||
virtual void setMotionType(PhysicsMotionType motionType);
|
||||
void updateCCDConfiguration();
|
||||
|
||||
void setRigidBody(btRigidBody* body);
|
||||
virtual void setRigidBody(btRigidBody* body);
|
||||
virtual void setShape(const btCollisionShape* shape);
|
||||
|
||||
MotionStateType _type { MOTIONSTATE_TYPE_INVALID }; // type of MotionState
|
||||
|
|
Loading…
Reference in a new issue