mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-11 05:43:04 +02:00
only domain zone entities control flying and ghosting
This commit is contained in:
parent
5553752d81
commit
2d0c1184e4
4 changed files with 18 additions and 9 deletions
|
@ -915,14 +915,9 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
|
|||
auto entityTreeRenderer = qApp->getEntities();
|
||||
EntityTreePointer entityTree = entityTreeRenderer ? entityTreeRenderer->getTree() : nullptr;
|
||||
if (entityTree) {
|
||||
bool zoneAllowsFlying = true;
|
||||
bool collisionlessAllowed = true;
|
||||
std::pair<bool, bool> zoneInteractionProperties;
|
||||
entityTree->withWriteLock([&] {
|
||||
std::shared_ptr<ZoneEntityItem> zone = entityTreeRenderer->myAvatarZone();
|
||||
if (zone) {
|
||||
zoneAllowsFlying = zone->getFlyingAllowed();
|
||||
collisionlessAllowed = zone->getGhostingAllowed();
|
||||
}
|
||||
zoneInteractionProperties = entityTreeRenderer->getZoneInteractionProperties();
|
||||
EntityEditPacketSender* packetSender = qApp->getEntityEditPacketSender();
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
// we need to update attached queryAACubes in our own local tree so point-select always works
|
||||
|
@ -935,6 +930,8 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
|
|||
});
|
||||
});
|
||||
bool isPhysicsEnabled = qApp->isPhysicsEnabled();
|
||||
bool zoneAllowsFlying = zoneInteractionProperties.first;
|
||||
bool collisionlessAllowed = zoneInteractionProperties.second;
|
||||
_characterController.setFlyingAllowed((zoneAllowsFlying && _enableFlying) || !isPhysicsEnabled);
|
||||
_characterController.setCollisionlessAllowed(collisionlessAllowed);
|
||||
}
|
||||
|
|
|
@ -1289,6 +1289,17 @@ CalculateEntityLoadingPriority EntityTreeRenderer::_calculateEntityLoadingPriori
|
|||
return 0.0f;
|
||||
};
|
||||
|
||||
std::pair<bool, bool> EntityTreeRenderer::getZoneInteractionProperties() {
|
||||
for (auto& zone : _layeredZones) {
|
||||
// Only domain entities control flying allowed and ghosting allowed
|
||||
if (zone.zone && zone.zone->isDomainEntity()) {
|
||||
return { zone.zone->getFlyingAllowed(), zone.zone->getGhostingAllowed() };
|
||||
}
|
||||
}
|
||||
|
||||
return { true, true };
|
||||
}
|
||||
|
||||
bool EntityTreeRenderer::wantsKeyboardFocus(const EntityItemID& id) const {
|
||||
auto renderable = renderableForEntityId(id);
|
||||
if (!renderable) {
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
// For Scene.shouldRenderEntities
|
||||
QList<EntityItemID>& getEntitiesLastInScene() { return _entityIDsLastInScene; }
|
||||
|
||||
std::shared_ptr<ZoneEntityItem> myAvatarZone() { return _layeredZones.getZone(); }
|
||||
std::pair<bool, bool> getZoneInteractionProperties();
|
||||
|
||||
bool wantsKeyboardFocus(const EntityItemID& id) const;
|
||||
QObject* getEventHandler(const EntityItemID& id);
|
||||
|
|
|
@ -1414,8 +1414,9 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
* @property {Entities.Bloom} bloom - The bloom properties of the zone.
|
||||
*
|
||||
* @property {boolean} flyingAllowed=true - If <code>true</code> then visitors can fly in the zone; otherwise they cannot.
|
||||
* Only works on domain entities.
|
||||
* @property {boolean} ghostingAllowed=true - If <code>true</code> then visitors with avatar collisions turned off will not
|
||||
* collide with content in the zone; otherwise visitors will always collide with content in the zone.
|
||||
* collide with content in the zone; otherwise visitors will always collide with content in the zone. Only works on domain entities.
|
||||
|
||||
* @property {string} filterURL="" - The URL of a JavaScript file that filters changes to properties of entities within the
|
||||
* zone. It is periodically executed for each entity in the zone. It can, for example, be used to not allow changes to
|
||||
|
|
Loading…
Reference in a new issue