have code where physics guesses at server values also avoid doing simple simulation of children of avatars

This commit is contained in:
Seth Alves 2016-06-09 14:35:17 -07:00
parent 3b85fc9ae3
commit 5650ef9d52
2 changed files with 14 additions and 4 deletions

View file

@ -263,7 +263,7 @@ void EntitySimulation::moveSimpleKinematics(const quint64& now) {
EntityItemPointer entity = *itemItr;
// 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;
entity->getMaximumAACube(ancestryIsKnown);
bool hasAvatarAncestor = entity->hasAncestorOfType(NestableType::Avatar);

View file

@ -317,9 +317,19 @@ bool EntityMotionState::remoteSimulationOutOfSync(uint32_t simulationStep) {
if (glm::length2(_serverVelocity) > 0.0f) {
_serverVelocity += _serverAcceleration * 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.
_serverPosition += dt * _serverVelocity;
// the entity-server doesn't know where avatars are, so it doesn't do simple extrapolation for children of
// 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()) {