mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 08:56:25 +02:00
Hover only editable entities
This commit is contained in:
parent
24b1963257
commit
e6e619f0d8
1 changed files with 13 additions and 0 deletions
|
@ -335,6 +335,9 @@
|
||||||
isLaserOn = false,
|
isLaserOn = false,
|
||||||
laseredEntityID = null,
|
laseredEntityID = null,
|
||||||
|
|
||||||
|
EDITIBLE_ENTITY_QUERY_PROPERTYES = ["parentID", "visible", "locked", "type"],
|
||||||
|
NONEDITABLE_ENTITY_TYPES = ["Unknown", "Zone", "Light"],
|
||||||
|
|
||||||
isEditing = false,
|
isEditing = false,
|
||||||
initialHandPosition,
|
initialHandPosition,
|
||||||
initialHandOrientationInverse,
|
initialHandOrientationInverse,
|
||||||
|
@ -403,6 +406,15 @@
|
||||||
laseredEntityID = null;
|
laseredEntityID = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isEditableEntity(entityID) {
|
||||||
|
// Entity trees are moved as a group so check the root entity.
|
||||||
|
var properties = Entities.getEntityProperties(entityID, EDITIBLE_ENTITY_QUERY_PROPERTYES);
|
||||||
|
while (properties.parentID && properties.parentID !== NULL_UUID) {
|
||||||
|
properties = Entities.getEntityProperties(properties.parentID, EDITIBLE_ENTITY_QUERY_PROPERTYES);
|
||||||
|
}
|
||||||
|
return properties.visible && !properties.locked && NONEDITABLE_ENTITY_TYPES.indexOf(properties.type) === -1;
|
||||||
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
var wasLaserOn,
|
var wasLaserOn,
|
||||||
handPose,
|
handPose,
|
||||||
|
@ -446,6 +458,7 @@
|
||||||
intersection = Entities.findRayIntersection(pickRay, PRECISION_PICKING, NO_INCLUDE_IDS, NO_EXCLUDE_IDS,
|
intersection = Entities.findRayIntersection(pickRay, PRECISION_PICKING, NO_INCLUDE_IDS, NO_EXCLUDE_IDS,
|
||||||
VISIBLE_ONLY);
|
VISIBLE_ONLY);
|
||||||
distance = isEditing ? editingDistance : (intersection.intersects ? intersection.distance : PICK_MAX_DISTANCE);
|
distance = isEditing ? editingDistance : (intersection.intersects ? intersection.distance : PICK_MAX_DISTANCE);
|
||||||
|
intersection.intersects = isEditableEntity(intersection.entityID);
|
||||||
|
|
||||||
// Laser, hover, edit.
|
// Laser, hover, edit.
|
||||||
isTriggerClicked = Controller.getValue(controllerTriggerClicked);
|
isTriggerClicked = Controller.getValue(controllerTriggerClicked);
|
||||||
|
|
Loading…
Reference in a new issue