force locked entities to be static in bullet

This commit is contained in:
Seth Alves 2017-05-20 11:54:42 -07:00
parent 6e89f7d2f9
commit 8f38ea8c6a
2 changed files with 9 additions and 0 deletions

View file

@ -2767,6 +2767,11 @@ void EntityItem::setLocked(bool value) {
withWriteLock([&] {
_locked = value;
});
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE);
EntityTreePointer tree = getTree();
if (tree) {
tree->entityChanged(getThisPointer());
}
}
QString EntityItem::getUserData() const {

View file

@ -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.