mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
get stylus working with web entities
This commit is contained in:
parent
07ab771c2b
commit
e5804dade0
1 changed files with 56 additions and 50 deletions
|
@ -1230,6 +1230,11 @@ function MyController(hand) {
|
||||||
if (rayPickInfo.overlayID && rayPickInfo.distance < WEB_DISPLAY_STYLUS_DISTANCE) {
|
if (rayPickInfo.overlayID && rayPickInfo.distance < WEB_DISPLAY_STYLUS_DISTANCE) {
|
||||||
this.showStylus();
|
this.showStylus();
|
||||||
this.hideStylusCounter = 0;
|
this.hideStylusCounter = 0;
|
||||||
|
} else if (rayPickInfo.entityID &&
|
||||||
|
rayPickInfo.properties.type == "Web" &&
|
||||||
|
rayPickInfo.distance < WEB_DISPLAY_STYLUS_DISTANCE) {
|
||||||
|
this.showStylus();
|
||||||
|
this.hideStylusCounter = 0;
|
||||||
} else {
|
} else {
|
||||||
this.hideStylusCounter++;
|
this.hideStylusCounter++;
|
||||||
if (this.hideStylusCounter > 10) {
|
if (this.hideStylusCounter > 10) {
|
||||||
|
@ -1242,62 +1247,62 @@ function MyController(hand) {
|
||||||
Controller.triggerHapticPulse(1, 20, this.hand);
|
Controller.triggerHapticPulse(1, 20, this.hand);
|
||||||
var pointerEvent;
|
var pointerEvent;
|
||||||
|
|
||||||
// if (rayPickInfo.entityID && Entities.wantsHandControllerPointerEvents(rayPickInfo.entityID)) {
|
if (rayPickInfo.entityID && Entities.wantsHandControllerPointerEvents(rayPickInfo.entityID)) {
|
||||||
// var entity = rayPickInfo.entityID;
|
var entity = rayPickInfo.entityID;
|
||||||
// name = entityPropertiesCache.getProps(entity).name;
|
var name = entityPropertiesCache.getProps(entity).name;
|
||||||
|
|
||||||
// if (Entities.keyboardFocusEntity != entity) {
|
if (Entities.keyboardFocusEntity != entity) {
|
||||||
// Overlays.keyboardFocusOverlay = 0;
|
Overlays.keyboardFocusOverlay = 0;
|
||||||
// Entities.keyboardFocusEntity = entity;
|
Entities.keyboardFocusEntity = entity;
|
||||||
|
|
||||||
// pointerEvent = {
|
pointerEvent = {
|
||||||
// type: "Move",
|
type: "Move",
|
||||||
// id: this.hand + 1, // 0 is reserved for hardware mouse
|
id: this.hand + 1, // 0 is reserved for hardware mouse
|
||||||
// pos2D: projectOntoEntityXYPlane(entity, rayPickInfo.intersection),
|
pos2D: projectOntoEntityXYPlane(entity, rayPickInfo.intersection),
|
||||||
// pos3D: rayPickInfo.intersection,
|
pos3D: rayPickInfo.intersection,
|
||||||
// normal: rayPickInfo.normal,
|
normal: rayPickInfo.normal,
|
||||||
// direction: rayPickInfo.searchRay.direction,
|
direction: rayPickInfo.searchRay.direction,
|
||||||
// button: "None"
|
button: "None"
|
||||||
// };
|
};
|
||||||
|
|
||||||
// this.hoverEntity = entity;
|
this.hoverEntity = entity;
|
||||||
// Entities.sendHoverEnterEntity(entity, pointerEvent);
|
Entities.sendHoverEnterEntity(entity, pointerEvent);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // send mouse events for button highlights and tooltips.
|
// send mouse events for button highlights and tooltips.
|
||||||
// if (this.hand == mostRecentSearchingHand || (this.hand !== mostRecentSearchingHand &&
|
if (this.hand == mostRecentSearchingHand || (this.hand !== mostRecentSearchingHand &&
|
||||||
// this.getOtherHandController().state !== STATE_SEARCHING &&
|
this.getOtherHandController().state !== STATE_SEARCHING &&
|
||||||
// this.getOtherHandController().state !== STATE_ENTITY_TOUCHING &&
|
this.getOtherHandController().state !== STATE_ENTITY_TOUCHING &&
|
||||||
// this.getOtherHandController().state !== STATE_OVERLAY_TOUCHING)) {
|
this.getOtherHandController().state !== STATE_OVERLAY_TOUCHING)) {
|
||||||
|
|
||||||
// // most recently searching hand has priority over other hand, for the purposes of button highlighting.
|
// most recently searching hand has priority over other hand, for the purposes of button highlighting.
|
||||||
// pointerEvent = {
|
pointerEvent = {
|
||||||
// type: "Move",
|
type: "Move",
|
||||||
// id: this.hand + 1, // 0 is reserved for hardware mouse
|
id: this.hand + 1, // 0 is reserved for hardware mouse
|
||||||
// pos2D: projectOntoEntityXYPlane(entity, rayPickInfo.intersection),
|
pos2D: projectOntoEntityXYPlane(entity, rayPickInfo.intersection),
|
||||||
// pos3D: rayPickInfo.intersection,
|
pos3D: rayPickInfo.intersection,
|
||||||
// normal: rayPickInfo.normal,
|
normal: rayPickInfo.normal,
|
||||||
// direction: rayPickInfo.searchRay.direction,
|
direction: rayPickInfo.searchRay.direction,
|
||||||
// button: "None"
|
button: "None"
|
||||||
// };
|
};
|
||||||
|
|
||||||
// Entities.sendMouseMoveOnEntity(entity, pointerEvent);
|
Entities.sendMouseMoveOnEntity(entity, pointerEvent);
|
||||||
// Entities.sendHoverOverEntity(entity, pointerEvent);
|
Entities.sendHoverOverEntity(entity, pointerEvent);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (!isEditing()) {
|
if (!isEditing()) {
|
||||||
// this.grabbedEntity = entity;
|
this.grabbedEntity = entity;
|
||||||
// this.setState(STATE_ENTITY_TOUCHING, "begin touching entity '" + name + "'");
|
this.setState(STATE_ENTITY_TOUCHING, "begin touching entity '" + name + "'");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// } else if (this.hoverEntity) {
|
} else if (this.hoverEntity) {
|
||||||
// pointerEvent = {
|
pointerEvent = {
|
||||||
// type: "Move",
|
type: "Move",
|
||||||
// id: this.hand + 1
|
id: this.hand + 1
|
||||||
// };
|
};
|
||||||
// Entities.sendHoverLeaveEntity(this.hoverEntity, pointerEvent);
|
Entities.sendHoverLeaveEntity(this.hoverEntity, pointerEvent);
|
||||||
// this.hoverEntity = null;
|
this.hoverEntity = null;
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (rayPickInfo.overlayID) {
|
if (rayPickInfo.overlayID) {
|
||||||
var overlay = rayPickInfo.overlayID;
|
var overlay = rayPickInfo.overlayID;
|
||||||
|
@ -1424,7 +1429,8 @@ function MyController(hand) {
|
||||||
searchRay: pickRay,
|
searchRay: pickRay,
|
||||||
distance: Vec3.distance(pickRay.origin, intersection.intersection),
|
distance: Vec3.distance(pickRay.origin, intersection.intersection),
|
||||||
intersection: intersection.intersection,
|
intersection: intersection.intersection,
|
||||||
normal: intersection.surfaceNormal
|
normal: intersection.surfaceNormal,
|
||||||
|
properties: intersection.properties
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue