mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:58:59 +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;
|
btVector3 velocity = glmToBullet(getObjectLinearVelocity()) + (1.0f / SPRING_TIMESCALE) * offsetToTarget;
|
||||||
_body->setLinearVelocity(velocity);
|
_body->setLinearVelocity(velocity);
|
||||||
_body->setAngularVelocity(glmToBullet(getObjectAngularVelocity()));
|
_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) {
|
void AvatarMotionState::setShape(const btCollisionShape* shape) {
|
||||||
cacheShapeDiameter();
|
cacheShapeDiameter();
|
||||||
ObjectMotionState::setShape(shape);
|
ObjectMotionState::setShape(shape);
|
||||||
|
|
|
@ -74,6 +74,7 @@ public:
|
||||||
friend class Avatar;
|
friend class Avatar;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void setRigidBody(btRigidBody* body) override;
|
||||||
void setShape(const btCollisionShape* shape) override;
|
void setShape(const btCollisionShape* shape) override;
|
||||||
void cacheShapeDiameter();
|
void cacheShapeDiameter();
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ protected:
|
||||||
virtual void setMotionType(PhysicsMotionType motionType);
|
virtual void setMotionType(PhysicsMotionType motionType);
|
||||||
void updateCCDConfiguration();
|
void updateCCDConfiguration();
|
||||||
|
|
||||||
void setRigidBody(btRigidBody* body);
|
virtual void setRigidBody(btRigidBody* body);
|
||||||
virtual void setShape(const btCollisionShape* shape);
|
virtual void setShape(const btCollisionShape* shape);
|
||||||
|
|
||||||
MotionStateType _type { MOTIONSTATE_TYPE_INVALID }; // type of MotionState
|
MotionStateType _type { MOTIONSTATE_TYPE_INVALID }; // type of MotionState
|
||||||
|
|
Loading…
Reference in a new issue