mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 13:02:24 +02:00
Merge pull request #10517 from sethalves/locked-entities-are-static
force locked entities to be static in bullet
This commit is contained in:
commit
c24561ec96
2 changed files with 16 additions and 1 deletions
|
@ -2764,9 +2764,20 @@ bool EntityItem::getLocked() const {
|
|||
}
|
||||
|
||||
void EntityItem::setLocked(bool value) {
|
||||
bool changed { false };
|
||||
withWriteLock([&] {
|
||||
_locked = value;
|
||||
if (_locked != value) {
|
||||
_locked = value;
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
if (changed) {
|
||||
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE);
|
||||
EntityTreePointer tree = getTree();
|
||||
if (tree) {
|
||||
tree->entityChanged(getThisPointer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString EntityItem::getUserData() const {
|
||||
|
|
|
@ -185,6 +185,10 @@ PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
|
|||
return MOTION_TYPE_STATIC;
|
||||
}
|
||||
|
||||
if (_entity->getLocked()) {
|
||||
return MOTION_TYPE_STATIC;
|
||||
}
|
||||
|
||||
if (_entity->getDynamic()) {
|
||||
if (!_entity->getParentID().isNull()) {
|
||||
// if something would have been dynamic but is a child of something else, force it to be kinematic, instead.
|
||||
|
|
Loading…
Reference in a new issue