mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:17:14 +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();
|
auto entityTreeRenderer = qApp->getEntities();
|
||||||
EntityTreePointer entityTree = entityTreeRenderer ? entityTreeRenderer->getTree() : nullptr;
|
EntityTreePointer entityTree = entityTreeRenderer ? entityTreeRenderer->getTree() : nullptr;
|
||||||
if (entityTree) {
|
if (entityTree) {
|
||||||
bool zoneAllowsFlying = true;
|
std::pair<bool, bool> zoneInteractionProperties;
|
||||||
bool collisionlessAllowed = true;
|
|
||||||
entityTree->withWriteLock([&] {
|
entityTree->withWriteLock([&] {
|
||||||
std::shared_ptr<ZoneEntityItem> zone = entityTreeRenderer->myAvatarZone();
|
zoneInteractionProperties = entityTreeRenderer->getZoneInteractionProperties();
|
||||||
if (zone) {
|
|
||||||
zoneAllowsFlying = zone->getFlyingAllowed();
|
|
||||||
collisionlessAllowed = zone->getGhostingAllowed();
|
|
||||||
}
|
|
||||||
EntityEditPacketSender* packetSender = qApp->getEntityEditPacketSender();
|
EntityEditPacketSender* packetSender = qApp->getEntityEditPacketSender();
|
||||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||||
// we need to update attached queryAACubes in our own local tree so point-select always works
|
// 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 isPhysicsEnabled = qApp->isPhysicsEnabled();
|
||||||
|
bool zoneAllowsFlying = zoneInteractionProperties.first;
|
||||||
|
bool collisionlessAllowed = zoneInteractionProperties.second;
|
||||||
_characterController.setFlyingAllowed((zoneAllowsFlying && _enableFlying) || !isPhysicsEnabled);
|
_characterController.setFlyingAllowed((zoneAllowsFlying && _enableFlying) || !isPhysicsEnabled);
|
||||||
_characterController.setCollisionlessAllowed(collisionlessAllowed);
|
_characterController.setCollisionlessAllowed(collisionlessAllowed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1289,6 +1289,17 @@ CalculateEntityLoadingPriority EntityTreeRenderer::_calculateEntityLoadingPriori
|
||||||
return 0.0f;
|
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 {
|
bool EntityTreeRenderer::wantsKeyboardFocus(const EntityItemID& id) const {
|
||||||
auto renderable = renderableForEntityId(id);
|
auto renderable = renderableForEntityId(id);
|
||||||
if (!renderable) {
|
if (!renderable) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
// For Scene.shouldRenderEntities
|
// For Scene.shouldRenderEntities
|
||||||
QList<EntityItemID>& getEntitiesLastInScene() { return _entityIDsLastInScene; }
|
QList<EntityItemID>& getEntitiesLastInScene() { return _entityIDsLastInScene; }
|
||||||
|
|
||||||
std::shared_ptr<ZoneEntityItem> myAvatarZone() { return _layeredZones.getZone(); }
|
std::pair<bool, bool> getZoneInteractionProperties();
|
||||||
|
|
||||||
bool wantsKeyboardFocus(const EntityItemID& id) const;
|
bool wantsKeyboardFocus(const EntityItemID& id) const;
|
||||||
QObject* getEventHandler(const EntityItemID& id);
|
QObject* getEventHandler(const EntityItemID& id);
|
||||||
|
|
|
@ -1414,8 +1414,9 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
* @property {Entities.Bloom} bloom - The bloom properties of the zone.
|
* @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.
|
* @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
|
* @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
|
* @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
|
* 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