mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
have code where physics guesses at server values also avoid doing simple simulation of children of avatars
This commit is contained in:
parent
3b85fc9ae3
commit
5650ef9d52
2 changed files with 14 additions and 4 deletions
|
@ -263,7 +263,7 @@ void EntitySimulation::moveSimpleKinematics(const quint64& now) {
|
||||||
EntityItemPointer entity = *itemItr;
|
EntityItemPointer entity = *itemItr;
|
||||||
|
|
||||||
// The entity-server doesn't know where avatars are, so don't attempt to do simple extrapolation for
|
// The entity-server doesn't know where avatars are, so don't attempt to do simple extrapolation for
|
||||||
// children of avatars.
|
// children of avatars. See related code in EntityMotionState::remoteSimulationOutOfSync.
|
||||||
bool ancestryIsKnown;
|
bool ancestryIsKnown;
|
||||||
entity->getMaximumAACube(ancestryIsKnown);
|
entity->getMaximumAACube(ancestryIsKnown);
|
||||||
bool hasAvatarAncestor = entity->hasAncestorOfType(NestableType::Avatar);
|
bool hasAvatarAncestor = entity->hasAncestorOfType(NestableType::Avatar);
|
||||||
|
|
|
@ -317,9 +317,19 @@ bool EntityMotionState::remoteSimulationOutOfSync(uint32_t simulationStep) {
|
||||||
if (glm::length2(_serverVelocity) > 0.0f) {
|
if (glm::length2(_serverVelocity) > 0.0f) {
|
||||||
_serverVelocity += _serverAcceleration * dt;
|
_serverVelocity += _serverAcceleration * dt;
|
||||||
_serverVelocity *= powf(1.0f - _body->getLinearDamping(), dt);
|
_serverVelocity *= powf(1.0f - _body->getLinearDamping(), dt);
|
||||||
// NOTE: we ignore the second-order acceleration term when integrating
|
|
||||||
// the position forward because Bullet also does this.
|
// the entity-server doesn't know where avatars are, so it doesn't do simple extrapolation for children of
|
||||||
_serverPosition += dt * _serverVelocity;
|
// avatars. We are trying to guess what values the entity server has, so we don't do it here, either. See
|
||||||
|
// related code in EntitySimulation::moveSimpleKinematics.
|
||||||
|
bool ancestryIsKnown;
|
||||||
|
_entity->getMaximumAACube(ancestryIsKnown);
|
||||||
|
bool hasAvatarAncestor = _entity->hasAncestorOfType(NestableType::Avatar);
|
||||||
|
|
||||||
|
if (ancestryIsKnown && !hasAvatarAncestor) {
|
||||||
|
// NOTE: we ignore the second-order acceleration term when integrating
|
||||||
|
// the position forward because Bullet also does this.
|
||||||
|
_serverPosition += dt * _serverVelocity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entity->actionDataNeedsTransmit()) {
|
if (_entity->actionDataNeedsTransmit()) {
|
||||||
|
|
Loading…
Reference in a new issue