mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 18:34:54 +02:00
adjust how EntityMotionState updates its idea of what the server knows about an entity
This commit is contained in:
parent
5e4f30b2bb
commit
82bd506086
2 changed files with 15 additions and 11 deletions
|
@ -611,7 +611,7 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString,
|
||||||
const QVariantMap& arguments) {
|
const QVariantMap& arguments) {
|
||||||
QUuid actionID = QUuid::createUuid();
|
QUuid actionID = QUuid::createUuid();
|
||||||
auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();
|
auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();
|
||||||
bool success = true;
|
bool success = false;
|
||||||
actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
|
actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
|
||||||
// create this action even if the entity doesn't have physics info. it will often be the
|
// create this action even if the entity doesn't have physics info. it will often be the
|
||||||
// case that a script adds an action immediately after an object is created, and the physicsInfo
|
// case that a script adds an action immediately after an object is created, and the physicsInfo
|
||||||
|
@ -621,11 +621,12 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString,
|
||||||
// }
|
// }
|
||||||
EntityActionType actionType = EntityActionInterface::actionTypeFromString(actionTypeString);
|
EntityActionType actionType = EntityActionInterface::actionTypeFromString(actionTypeString);
|
||||||
if (actionType == ACTION_TYPE_NONE) {
|
if (actionType == ACTION_TYPE_NONE) {
|
||||||
success = false;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
EntityActionPointer action = actionFactory->factory(actionType, actionID, entity, arguments);
|
EntityActionPointer action = actionFactory->factory(actionType, actionID, entity, arguments);
|
||||||
if (action) {
|
if (!action) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
success = entity->addAction(simulation, action);
|
success = entity->addAction(simulation, action);
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
const QUuid myNodeID = nodeList->getSessionUUID();
|
const QUuid myNodeID = nodeList->getSessionUUID();
|
||||||
|
@ -633,8 +634,6 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString,
|
||||||
entity->flagForOwnership();
|
entity->flagForOwnership();
|
||||||
}
|
}
|
||||||
return false; // Physics will cause a packet to be sent, so don't send from here.
|
return false; // Physics will cause a packet to be sent, so don't send from here.
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
if (success) {
|
if (success) {
|
||||||
return actionID;
|
return actionID;
|
||||||
|
|
|
@ -86,6 +86,11 @@ void EntityMotionState::updateServerPhysicsVariables(const QUuid& sessionID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_entity->shouldSuppressLocationEdits()) {
|
||||||
|
// if we send now, the changes will be ignored, so don't update our idea of what the server knows.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_serverPosition = _entity->getPosition();
|
_serverPosition = _entity->getPosition();
|
||||||
_serverRotation = _entity->getRotation();
|
_serverRotation = _entity->getRotation();
|
||||||
_serverVelocity = _entity->getVelocity();
|
_serverVelocity = _entity->getVelocity();
|
||||||
|
|
Loading…
Reference in a new issue