mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
Merge pull request #547 from HifiExperiments/scaled
Fix lag on restart with scaled avatar
This commit is contained in:
commit
180b7f1bd3
3 changed files with 8 additions and 12 deletions
|
@ -407,13 +407,13 @@ void MyCharacterController::clearDetailedMotionStates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyCharacterController::buildPhysicsTransaction(PhysicsEngine::Transaction& transaction) {
|
void MyCharacterController::buildPhysicsTransaction(PhysicsEngine::Transaction& transaction) {
|
||||||
for (size_t i = 0; i < _detailedMotionStates.size(); i++) {
|
for (auto& detailedMotionState : _detailedMotionStates) {
|
||||||
_detailedMotionStates[i]->forceActive();
|
detailedMotionState->forceActive();
|
||||||
}
|
}
|
||||||
if (_pendingFlags & PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION) {
|
if (_pendingFlags & PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION) {
|
||||||
_pendingFlags &= ~PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION;
|
_pendingFlags &= ~PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION;
|
||||||
for (size_t i = 0; i < _detailedMotionStates.size(); i++) {
|
for (auto& detailedMotionState : _detailedMotionStates) {
|
||||||
transaction.objectsToRemove.push_back(_detailedMotionStates[i]);
|
transaction.objectsToRemove.push_back(detailedMotionState);
|
||||||
}
|
}
|
||||||
// NOTE: the DetailedMotionStates are deleted after being added to PhysicsEngine::Transaction::_objectsToRemove
|
// NOTE: the DetailedMotionStates are deleted after being added to PhysicsEngine::Transaction::_objectsToRemove
|
||||||
// See AvatarManager::handleProcessedPhysicsTransaction()
|
// See AvatarManager::handleProcessedPhysicsTransaction()
|
||||||
|
|
|
@ -116,10 +116,10 @@ void OtherAvatar::updateSpaceProxy(workload::Transaction& transaction) const {
|
||||||
|
|
||||||
int OtherAvatar::parseDataFromBuffer(const QByteArray& buffer) {
|
int OtherAvatar::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
int32_t bytesRead = Avatar::parseDataFromBuffer(buffer);
|
int32_t bytesRead = Avatar::parseDataFromBuffer(buffer);
|
||||||
for (size_t i = 0; i < _detailedMotionStates.size(); i++) {
|
for (auto& detailedMotionState : _detailedMotionStates) {
|
||||||
// NOTE: we activate _detailedMotionStates is because they are KINEMATIC
|
// NOTE: we activate _detailedMotionStates is because they are KINEMATIC
|
||||||
// and Bullet will automagically call DetailedMotionState::getWorldTransform() when active.
|
// and Bullet will automagically call DetailedMotionState::getWorldTransform() when active.
|
||||||
_detailedMotionStates[i]->forceActive();
|
detailedMotionState->forceActive();
|
||||||
}
|
}
|
||||||
if (_moving && _motionState) {
|
if (_moving && _motionState) {
|
||||||
_motionState->addDirtyFlags(Simulation::DIRTY_POSITION);
|
_motionState->addDirtyFlags(Simulation::DIRTY_POSITION);
|
||||||
|
|
|
@ -543,12 +543,8 @@ void CharacterController::setLocalBoundingBox(const glm::vec3& minCorner, const
|
||||||
_minStepHeight = DEFAULT_MIN_STEP_HEIGHT_FACTOR * (_halfHeight + _radius);
|
_minStepHeight = DEFAULT_MIN_STEP_HEIGHT_FACTOR * (_halfHeight + _radius);
|
||||||
_maxStepHeight = DEFAULT_MAX_STEP_HEIGHT_FACTOR * (_halfHeight + _radius);
|
_maxStepHeight = DEFAULT_MAX_STEP_HEIGHT_FACTOR * (_halfHeight + _radius);
|
||||||
|
|
||||||
if (_physicsEngine) {
|
_pendingFlags |= PENDING_FLAG_UPDATE_SHAPE | PENDING_FLAG_REMOVE_FROM_SIMULATION | PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION |
|
||||||
// must REMOVE from world prior to shape update
|
PENDING_FLAG_ADD_TO_SIMULATION | PENDING_FLAG_ADD_DETAILED_TO_SIMULATION;
|
||||||
_pendingFlags |= PENDING_FLAG_REMOVE_FROM_SIMULATION | PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION;
|
|
||||||
}
|
|
||||||
_pendingFlags |= PENDING_FLAG_UPDATE_SHAPE;
|
|
||||||
_pendingFlags |= PENDING_FLAG_ADD_TO_SIMULATION | PENDING_FLAG_ADD_DETAILED_TO_SIMULATION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// it's ok to change offset immediately -- there are no thread safety issues here
|
// it's ok to change offset immediately -- there are no thread safety issues here
|
||||||
|
|
Loading…
Reference in a new issue