mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:38:29 +02:00
better version
This commit is contained in:
parent
8cbe63f296
commit
b3ec306063
1 changed files with 12 additions and 4 deletions
|
@ -1801,14 +1801,19 @@ function MyController(hand) {
|
||||||
|
|
||||||
this.processStylus();
|
this.processStylus();
|
||||||
|
|
||||||
if (isInEditMode() && !this.isNearStylusTarget && HMD.isHandControllerAvailable() && HMD.active) {
|
if (isInEditMode() && !this.isNearStylusTarget && HMD.isHandControllerAvailable()) {
|
||||||
// Always showing lasers while in edit mode and hands/stylus is not active.
|
// Always showing lasers while in edit mode and hands/stylus is not active.
|
||||||
|
|
||||||
var rayPickInfo = this.calcRayPickInfo(this.hand);
|
var rayPickInfo = this.calcRayPickInfo(this.hand);
|
||||||
|
if (rayPickInfo.isValid) {
|
||||||
this.intersectionDistance = (rayPickInfo.entityID || rayPickInfo.overlayID) ? rayPickInfo.distance : 0;
|
this.intersectionDistance = (rayPickInfo.entityID || rayPickInfo.overlayID) ? rayPickInfo.distance : 0;
|
||||||
this.searchIndicatorOn(rayPickInfo.searchRay);
|
this.searchIndicatorOn(rayPickInfo.searchRay);
|
||||||
} else {
|
} else {
|
||||||
this.searchIndicatorOff();
|
this.searchIndicatorOff();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.searchIndicatorOff();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.handleLaserOnHomeButton = function(rayPickInfo) {
|
this.handleLaserOnHomeButton = function(rayPickInfo) {
|
||||||
|
@ -1854,12 +1859,14 @@ function MyController(hand) {
|
||||||
this.calcRayPickInfo = function(hand, pickRayOverride) {
|
this.calcRayPickInfo = function(hand, pickRayOverride) {
|
||||||
|
|
||||||
var pickRay;
|
var pickRay;
|
||||||
|
var valid = true
|
||||||
if (pickRayOverride) {
|
if (pickRayOverride) {
|
||||||
pickRay = pickRayOverride;
|
pickRay = pickRayOverride;
|
||||||
} else {
|
} else {
|
||||||
var controllerLocation = getControllerWorldLocation(this.handToController(), true);
|
var controllerLocation = getControllerWorldLocation(this.handToController(), true);
|
||||||
var worldHandPosition = controllerLocation.position;
|
var worldHandPosition = controllerLocation.position;
|
||||||
var worldHandRotation = controllerLocation.orientation;
|
var worldHandRotation = controllerLocation.orientation;
|
||||||
|
valid = !(worldHandPosition === undefined);
|
||||||
|
|
||||||
pickRay = {
|
pickRay = {
|
||||||
origin: PICK_WITH_HAND_RAY ? worldHandPosition : Camera.position,
|
origin: PICK_WITH_HAND_RAY ? worldHandPosition : Camera.position,
|
||||||
|
@ -1874,7 +1881,8 @@ function MyController(hand) {
|
||||||
entityID: null,
|
entityID: null,
|
||||||
overlayID: null,
|
overlayID: null,
|
||||||
searchRay: pickRay,
|
searchRay: pickRay,
|
||||||
distance: PICK_MAX_DISTANCE
|
distance: PICK_MAX_DISTANCE,
|
||||||
|
isValid: valid
|
||||||
};
|
};
|
||||||
|
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
|
|
Loading…
Reference in a new issue