mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
count steps during which an EntityItem is moving but has no simulation owner. Once the count is high enough (how high is TBD), attempt to claim ownership
This commit is contained in:
parent
48ec0c8339
commit
81ff8a4448
2 changed files with 9 additions and 1 deletions
|
@ -38,7 +38,8 @@ void EntityMotionState::enqueueOutgoingEntity(EntityItem* entity) {
|
|||
EntityMotionState::EntityMotionState(EntityItem* entity) :
|
||||
_entity(entity),
|
||||
_accelerationNearlyGravityCount(0),
|
||||
_shouldClaimSimulationOwnership(false)
|
||||
_shouldClaimSimulationOwnership(false),
|
||||
_movingStepsWithoutSimulationOwner(0)
|
||||
{
|
||||
_type = MOTION_STATE_TYPE_ENTITY;
|
||||
assert(entity != NULL);
|
||||
|
@ -116,6 +117,12 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
|||
|
||||
if (_entity->getSimulatorID().isNull() && isMoving()) {
|
||||
// object is moving and has no owner. attempt to claim simulation ownership.
|
||||
_movingStepsWithoutSimulationOwner++;
|
||||
} else {
|
||||
_movingStepsWithoutSimulationOwner = 0;
|
||||
}
|
||||
|
||||
if (_movingStepsWithoutSimulationOwner > 4) { // XXX maybe meters from our characterController ?
|
||||
setShouldClaimSimulationOwnership(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ protected:
|
|||
EntityItem* _entity;
|
||||
quint8 _accelerationNearlyGravityCount;
|
||||
bool _shouldClaimSimulationOwnership;
|
||||
quint32 _movingStepsWithoutSimulationOwner;
|
||||
};
|
||||
|
||||
#endif // hifi_EntityMotionState_h
|
||||
|
|
Loading…
Reference in a new issue