mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 06:29:50 +02:00
don't allow others' grabs to move locked or ungrabbable things
This commit is contained in:
parent
dc6bdfae8a
commit
db821487d9
1 changed files with 11 additions and 0 deletions
|
@ -32,6 +32,17 @@ void GrabManager::simulateGrabs() {
|
||||||
bool success;
|
bool success;
|
||||||
SpatiallyNestablePointer grabbedThing = SpatiallyNestable::findByID(grabbedThingID, success);
|
SpatiallyNestablePointer grabbedThing = SpatiallyNestable::findByID(grabbedThingID, success);
|
||||||
if (success && grabbedThing) {
|
if (success && grabbedThing) {
|
||||||
|
auto entity = std::dynamic_pointer_cast<EntityItem>(grabbedThing);
|
||||||
|
if (entity) {
|
||||||
|
if (entity->getLocked()) {
|
||||||
|
continue; // even if someone else claims to be grabbing it, don't move a locked thing
|
||||||
|
}
|
||||||
|
const GrabPropertyGroup& grabProps = entity->getGrabProperties();
|
||||||
|
if (!grabProps.getGrabbable()) {
|
||||||
|
continue; // even if someone else claims to be grabbing it, don't move non-grabbable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 finalPosition = acc.finalizePosition();
|
glm::vec3 finalPosition = acc.finalizePosition();
|
||||||
glm::quat finalOrientation = acc.finalizeOrientation();
|
glm::quat finalOrientation = acc.finalizeOrientation();
|
||||||
grabbedThing->setTransform(createMatFromQuatAndPos(finalOrientation, finalPosition));
|
grabbedThing->setTransform(createMatFromQuatAndPos(finalOrientation, finalPosition));
|
||||||
|
|
Loading…
Reference in a new issue