mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
trying to fix interaction with grab script...
This commit is contained in:
parent
7fa1dc7053
commit
f8ff0da901
3 changed files with 55 additions and 8 deletions
17
scripts/developer/utilities/tools/overlayFinder.js
Normal file
17
scripts/developer/utilities/tools/overlayFinder.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
function mousePressEvent(event) {
|
||||||
|
var overlay = Overlays.getOverlayAtPoint({x:event.x,y:event.y});
|
||||||
|
print('overlay is: ' + overlay)
|
||||||
|
// var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
|
||||||
|
// var intersection = Overlays.findRayIntersection(pickRay);
|
||||||
|
// print('intersection is: ' + intersection)
|
||||||
|
};
|
||||||
|
|
||||||
|
Controller.mouseMoveEvent.connect(function(event){
|
||||||
|
print('mouse press')
|
||||||
|
mousePressEvent(event)
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function(){
|
||||||
|
Controller.mousePressEvent.disconnect(mousePressEvent);
|
||||||
|
})
|
|
@ -367,7 +367,6 @@ function MyController(hand) {
|
||||||
// for lights
|
// for lights
|
||||||
this.spotlight = null;
|
this.spotlight = null;
|
||||||
this.pointlight = null;
|
this.pointlight = null;
|
||||||
this.overlayLine = null;
|
|
||||||
this.searchSphere = null;
|
this.searchSphere = null;
|
||||||
|
|
||||||
this.waitForTriggerRelease = false;
|
this.waitForTriggerRelease = false;
|
||||||
|
@ -400,6 +399,7 @@ function MyController(hand) {
|
||||||
this.updateSmoothedTrigger();
|
this.updateSmoothedTrigger();
|
||||||
|
|
||||||
if (this.ignoreInput()) {
|
if (this.ignoreInput()) {
|
||||||
|
// print('in ignore input turn off')
|
||||||
this.turnOffVisualizations();
|
this.turnOffVisualizations();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -531,6 +531,7 @@ function MyController(hand) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.overlayLineOn = function(closePoint, farPoint, color) {
|
this.overlayLineOn = function(closePoint, farPoint, color) {
|
||||||
|
|
||||||
if (this.overlayLine === null) {
|
if (this.overlayLine === null) {
|
||||||
var lineProperties = {
|
var lineProperties = {
|
||||||
lineWidth: 5,
|
lineWidth: 5,
|
||||||
|
@ -543,6 +544,7 @@ function MyController(hand) {
|
||||||
alpha: 1
|
alpha: 1
|
||||||
};
|
};
|
||||||
this.overlayLine = Overlays.addOverlay("line3d", lineProperties);
|
this.overlayLine = Overlays.addOverlay("line3d", lineProperties);
|
||||||
|
print('CREATED OVERLAY IT IS ' + this.overlayLine )
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Overlays.editOverlay(this.overlayLine, {
|
Overlays.editOverlay(this.overlayLine, {
|
||||||
|
@ -555,7 +557,9 @@ function MyController(hand) {
|
||||||
drawInFront: true, // Even when burried inside of something, show it.
|
drawInFront: true, // Even when burried inside of something, show it.
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
print('edited overlay line ' + this.overlayLine )
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.searchIndicatorOn = function(distantPickRay) {
|
this.searchIndicatorOn = function(distantPickRay) {
|
||||||
|
@ -758,14 +762,20 @@ function MyController(hand) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.overlayLineOff = function() {
|
this.overlayLineOff = function() {
|
||||||
|
return;
|
||||||
if (this.overlayLine !== null) {
|
if (this.overlayLine !== null) {
|
||||||
Overlays.deleteOverlay(this.overlayLine);
|
Overlays.deleteOverlay(this.overlayLine);
|
||||||
|
print('REMOVING OVERLAY LINE' + this.overlayLine)
|
||||||
|
this.overlayLine = null;
|
||||||
}
|
}
|
||||||
this.overlayLine = null;
|
|
||||||
|
// print('overlay shoudl be null and is line is ' + this.overlayLine)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.searchSphereOff = function() {
|
this.searchSphereOff = function() {
|
||||||
if (this.searchSphere !== null) {
|
if (this.searchSphere !== null) {
|
||||||
|
print('removing search sphere' + this.searchSphere)
|
||||||
Overlays.deleteOverlay(this.searchSphere);
|
Overlays.deleteOverlay(this.searchSphere);
|
||||||
this.searchSphere = null;
|
this.searchSphere = null;
|
||||||
this.searchSphereDistance = DEFAULT_SEARCH_SPHERE_DISTANCE;
|
this.searchSphereDistance = DEFAULT_SEARCH_SPHERE_DISTANCE;
|
||||||
|
@ -792,21 +802,28 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.turnOffVisualizations = function() {
|
this.turnOffVisualizations = function(hand) {
|
||||||
|
// print('TURN OFF VISUALIZATIONS: ' + hand)
|
||||||
if (USE_ENTITY_LINES_FOR_SEARCHING === true || USE_ENTITY_LINES_FOR_MOVING === true) {
|
if (USE_ENTITY_LINES_FOR_SEARCHING === true || USE_ENTITY_LINES_FOR_MOVING === true) {
|
||||||
this.lineOff();
|
this.lineOff();
|
||||||
|
// print('after line off')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (USE_OVERLAY_LINES_FOR_SEARCHING === true || USE_OVERLAY_LINES_FOR_MOVING === true) {
|
if (USE_OVERLAY_LINES_FOR_SEARCHING === true || USE_OVERLAY_LINES_FOR_MOVING === true) {
|
||||||
this.overlayLineOff();
|
this.overlayLineOff();
|
||||||
|
// print('after overlay line off')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (USE_PARTICLE_BEAM_FOR_MOVING === true) {
|
if (USE_PARTICLE_BEAM_FOR_MOVING === true) {
|
||||||
this.particleBeamOff();
|
this.particleBeamOff();
|
||||||
|
// print('after particle beam off')
|
||||||
|
|
||||||
}
|
}
|
||||||
this.searchSphereOff();
|
this.searchSphereOff();
|
||||||
restore2DMode();
|
restore2DMode();
|
||||||
|
|
||||||
|
// print('after all turn off calls')
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.triggerPress = function(value) {
|
this.triggerPress = function(value) {
|
||||||
|
@ -2232,11 +2249,18 @@ var handleHandMessages = function(channel, message, sender) {
|
||||||
if (sender === MyAvatar.sessionUUID) {
|
if (sender === MyAvatar.sessionUUID) {
|
||||||
if (channel === 'Hifi-Hand-Disabler') {
|
if (channel === 'Hifi-Hand-Disabler') {
|
||||||
if (message === 'left') {
|
if (message === 'left') {
|
||||||
|
leftController.turnOffVisualizations('left');
|
||||||
handToDisable = LEFT_HAND;
|
handToDisable = LEFT_HAND;
|
||||||
}
|
}
|
||||||
if (message === 'right') {
|
if (message === 'right') {
|
||||||
|
rightController.turnOffVisualizations('right');
|
||||||
handToDisable = RIGHT_HAND;
|
handToDisable = RIGHT_HAND;
|
||||||
}
|
}
|
||||||
|
if (message === "both") {
|
||||||
|
print('disable both')
|
||||||
|
leftController.turnOffVisualizations('left');
|
||||||
|
rightController.turnOffVisualizations('right');
|
||||||
|
}
|
||||||
if (message === 'both' || message === 'none') {
|
if (message === 'both' || message === 'none') {
|
||||||
handToDisable = message;
|
handToDisable = message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,7 @@ function Teleporter() {
|
||||||
this.updateConnected = null;
|
this.updateConnected = null;
|
||||||
this.smoothArrivalInterval = null;
|
this.smoothArrivalInterval = null;
|
||||||
this.fadeSphere = null;
|
this.fadeSphere = null;
|
||||||
|
this.teleportHand = null;
|
||||||
|
|
||||||
this.initialize = function() {
|
this.initialize = function() {
|
||||||
this.createMappings();
|
this.createMappings();
|
||||||
|
@ -265,7 +266,7 @@ function Teleporter() {
|
||||||
} else {
|
} else {
|
||||||
Script.update.disconnect(this.update);
|
Script.update.disconnect(this.update);
|
||||||
}
|
}
|
||||||
|
this.teleportHand = null;
|
||||||
this.updateConnected = null;
|
this.updateConnected = null;
|
||||||
this.disableMappings();
|
this.disableMappings();
|
||||||
this.turnOffOverlayBeams();
|
this.turnOffOverlayBeams();
|
||||||
|
@ -301,6 +302,7 @@ function Teleporter() {
|
||||||
teleporter.leftRay();
|
teleporter.leftRay();
|
||||||
|
|
||||||
if ((leftPad.buttonValue === 0 || leftTrigger.buttonValue === 0) && inTeleportMode === true) {
|
if ((leftPad.buttonValue === 0 || leftTrigger.buttonValue === 0) && inTeleportMode === true) {
|
||||||
|
print('TELEPORTING LEFT')
|
||||||
_this.teleport();
|
_this.teleport();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -309,6 +311,8 @@ function Teleporter() {
|
||||||
teleporter.rightRay();
|
teleporter.rightRay();
|
||||||
|
|
||||||
if ((rightPad.buttonValue === 0 || rightTrigger.buttonValue === 0) && inTeleportMode === true) {
|
if ((rightPad.buttonValue === 0 || rightTrigger.buttonValue === 0) && inTeleportMode === true) {
|
||||||
|
|
||||||
|
print('TELEPORTING RIGHT')
|
||||||
_this.teleport();
|
_this.teleport();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -429,6 +433,7 @@ function Teleporter() {
|
||||||
visible: true,
|
visible: true,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
solid: true,
|
solid: true,
|
||||||
|
drawInFront: true,
|
||||||
glow: 1.0
|
glow: 1.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -457,7 +462,8 @@ function Teleporter() {
|
||||||
visible: true,
|
visible: true,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
solid: true,
|
solid: true,
|
||||||
glow: 1.0
|
glow: 1.0,
|
||||||
|
drawInFront: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.leftOverlayLine = Overlays.addOverlay("line3d", lineProperties);
|
this.leftOverlayLine = Overlays.addOverlay("line3d", lineProperties);
|
||||||
|
@ -506,7 +512,7 @@ function Teleporter() {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.disableGrab = function() {
|
this.disableGrab = function() {
|
||||||
Messages.sendLocalMessage('Hifi-Hand-Disabler', 'both');
|
Messages.sendLocalMessage('Hifi-Hand-Disabler', this.teleportHand);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.enableGrab = function() {
|
this.enableGrab = function() {
|
||||||
|
@ -514,7 +520,7 @@ function Teleporter() {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.triggerHaptics = function() {
|
this.triggerHaptics = function() {
|
||||||
var hand = this.hand === 'left' ? 0 : 1;
|
var hand = this.teleportHand === 'left' ? 0 : 1;
|
||||||
var haptic = Controller.triggerShortHapticPulse(0.2, hand);
|
var haptic = Controller.triggerShortHapticPulse(0.2, hand);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue