mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 05:43:36 +02:00
don't increase moving-without-simulator counter unless the thing is moving enough
This commit is contained in:
parent
fe308c0189
commit
86ec12b22c
2 changed files with 21 additions and 6 deletions
|
@ -389,5 +389,13 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern const float IGNORE_POSITION_DELTA;
|
||||||
|
extern const float IGNORE_DIMENSIONS_DELTA;
|
||||||
|
extern const float IGNORE_ALIGNMENT_DOT;
|
||||||
|
extern const float IGNORE_LINEAR_VELOCITY_DELTA;
|
||||||
|
extern const float IGNORE_DAMPING_DELTA;
|
||||||
|
extern const float IGNORE_GRAVITY_DELTA;
|
||||||
|
extern const float IGNORE_ANGULAR_VELOCITY_DELTA;
|
||||||
|
|
||||||
|
|
||||||
#endif // hifi_EntityItem_h
|
#endif // hifi_EntityItem_h
|
||||||
|
|
|
@ -104,16 +104,23 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
||||||
|
|
||||||
_entity->setLastSimulated(usecTimestampNow());
|
_entity->setLastSimulated(usecTimestampNow());
|
||||||
|
|
||||||
if (_entity->getSimulatorID().isNull() && isMoving()) {
|
// if (_entity->getSimulatorID().isNull() && isMoving()) {
|
||||||
// object is moving and has no owner. attempt to claim simulation ownership.
|
if (_entity->getSimulatorID().isNull()) {
|
||||||
_movingStepsWithoutSimulationOwner++;
|
// if object is moving and has no owner, attempt to claim simulation ownership.
|
||||||
|
auto alignmentDot = glm::abs(glm::dot(_sentRotation, _entity->getRotation()));
|
||||||
|
if (glm::distance(_sentPosition, _entity->getPosition()) > IGNORE_POSITION_DELTA ||
|
||||||
|
alignmentDot < IGNORE_ALIGNMENT_DOT) {
|
||||||
|
_movingStepsWithoutSimulationOwner++;
|
||||||
|
} else {
|
||||||
|
_movingStepsWithoutSimulationOwner = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_movingStepsWithoutSimulationOwner = 0;
|
_movingStepsWithoutSimulationOwner = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_movingStepsWithoutSimulationOwner > 100) { // XXX maybe meters from our characterController ?
|
if (_movingStepsWithoutSimulationOwner > 50) { // XXX maybe meters from our characterController ?
|
||||||
// qDebug() << "XXX XXX XXX -- claiming something I saw moving";
|
qDebug() << "XXX XXX XXX -- claiming something I saw moving";
|
||||||
// setShouldClaimSimulationOwnership(true);
|
setShouldClaimSimulationOwnership(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
|
|
Loading…
Reference in a new issue