mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 22:30:42 +02:00
disable positionand velocity script edits on grabbed entities
This commit is contained in:
parent
bf46960dc3
commit
3ccbd0bc7b
5 changed files with 26 additions and 0 deletions
|
@ -3595,6 +3595,18 @@ bool EntityItemProperties::hasTransformOrVelocityChanges() const {
|
|||
|| _accelerationChanged;
|
||||
}
|
||||
|
||||
void EntityItemProperties::clearTransformOrVelocityChanges() {
|
||||
_positionChanged = false;
|
||||
_localPositionChanged = false;
|
||||
_rotationChanged = false;
|
||||
_localRotationChanged = false;
|
||||
_velocityChanged = false;
|
||||
_localVelocityChanged = false;
|
||||
_angularVelocityChanged = false;
|
||||
_localAngularVelocityChanged = false;
|
||||
_accelerationChanged = false;
|
||||
}
|
||||
|
||||
bool EntityItemProperties::hasMiscPhysicsChanges() const {
|
||||
return _gravityChanged || _dimensionsChanged || _densityChanged || _frictionChanged
|
||||
|| _restitutionChanged || _dampingChanged || _angularDampingChanged || _registrationPointChanged ||
|
||||
|
|
|
@ -390,6 +390,7 @@ public:
|
|||
void setCreated(QDateTime& v);
|
||||
|
||||
bool hasTransformOrVelocityChanges() const;
|
||||
void clearTransformOrVelocityChanges();
|
||||
bool hasMiscPhysicsChanges() const;
|
||||
|
||||
bool hasSimulationRestrictedChanges() const;
|
||||
|
|
|
@ -816,6 +816,10 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
|||
|
||||
QString previousUserdata;
|
||||
if (entity) {
|
||||
if (properties.hasTransformOrVelocityChanges() && entity->hasGrabs()) {
|
||||
// if an entity is grabbed, the grab will override any position changes
|
||||
properties.clearTransformOrVelocityChanges();
|
||||
}
|
||||
if (properties.hasSimulationRestrictedChanges()) {
|
||||
if (_bidOnSimulationOwnership) {
|
||||
// flag for simulation ownership, or upgrade existing ownership priority
|
||||
|
|
|
@ -1386,6 +1386,14 @@ void SpatiallyNestable::removeGrab(GrabPointer grab) {
|
|||
});
|
||||
}
|
||||
|
||||
bool SpatiallyNestable::hasGrabs() {
|
||||
bool result { false };
|
||||
_grabsLock.withReadLock([&] {
|
||||
result = !_grabs.isEmpty();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
QUuid SpatiallyNestable::getEditSenderID() {
|
||||
// if more than one avatar is grabbing something, decide which one should tell the enity-server about it
|
||||
QUuid editSenderID;
|
||||
|
|
|
@ -216,6 +216,7 @@ public:
|
|||
|
||||
virtual void addGrab(GrabPointer grab);
|
||||
virtual void removeGrab(GrabPointer grab);
|
||||
bool hasGrabs();
|
||||
virtual QUuid getEditSenderID();
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue