don't accept incoming location edits if an entity is being controlled by a shouldSuppressLocationEdits action

This commit is contained in:
Seth Alves 2015-10-19 16:05:10 -07:00
parent a1cfebc173
commit 00594f0cce
3 changed files with 29 additions and 5 deletions

View file

@ -1808,3 +1808,27 @@ bool EntityItem::shouldSuppressLocationEdits() const {
return false;
}
void EntityItem::setPosition(const glm::vec3& value) {
if (!entity->shouldSuppressLocationEdits()) {
_transform.setTranslation(value); requiresRecalcBoxes();
}
}
void EntityItem::setRotation(const glm::quat& rotation) {
if (!entity->shouldSuppressLocationEdits()) {
_transform.setRotation(rotation); requiresRecalcBoxes();
}
}
void EntityItem::setVelocity(const glm::vec3& value) {
if (!entity->shouldSuppressLocationEdits()) {
_velocity = value;
}
}
void EntityItem::setAcceleration(const glm::vec3& value) {
if (!entity->shouldSuppressLocationEdits()) {
_acceleration = value;
}
}

View file

@ -209,10 +209,10 @@ public:
/// Position in meters (-TREE_SCALE - TREE_SCALE)
inline const glm::vec3& getPosition() const { return _transform.getTranslation(); }
inline void setPosition(const glm::vec3& value) { _transform.setTranslation(value); requiresRecalcBoxes(); }
void setPosition(const glm::vec3& value);
inline const glm::quat& getRotation() const { return _transform.getRotation(); }
inline void setRotation(const glm::quat& rotation) { _transform.setRotation(rotation); requiresRecalcBoxes(); }
inline void setRotation(const glm::quat& rotation);
inline void requiresRecalcBoxes() { _recalcAABox = true; _recalcMinAACube = true; _recalcMaxAACube = true; }
@ -240,7 +240,7 @@ public:
float getDensity() const { return _density; }
const glm::vec3& getVelocity() const { return _velocity; } /// get velocity in meters
void setVelocity(const glm::vec3& value) { _velocity = value; } /// velocity in meters
void setVelocity(const glm::vec3& value);
bool hasVelocity() const { return _velocity != ENTITY_ITEM_ZERO_VEC3; }
const glm::vec3& getGravity() const { return _gravity; } /// get gravity in meters
@ -248,7 +248,7 @@ public:
bool hasGravity() const { return _gravity != ENTITY_ITEM_ZERO_VEC3; }
const glm::vec3& getAcceleration() const { return _acceleration; } /// get acceleration in meters/second/second
void setAcceleration(const glm::vec3& value) { _acceleration = value; } /// acceleration in meters/second/second
void setAcceleration(const glm::vec3& value); /// acceleration in meters/second/second
bool hasAcceleration() const { return _acceleration != ENTITY_ITEM_ZERO_VEC3; }
float getDamping() const { return _damping; }

View file

@ -189,7 +189,7 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
} else {
simulationBlocked = senderID != entity->getSimulatorID();
}
if (simulationBlocked || entity->shouldSuppressLocationEdits()) {
if (simulationBlocked) {
// squash ownership and physics-related changes.
properties.setSimulationOwnerChanged(false);
properties.setPositionChanged(false);