mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 10:28:57 +02:00
use click instead of trigger, change targets to PNG
This commit is contained in:
parent
7d9937e412
commit
6051fcd8f9
5 changed files with 12 additions and 114 deletions
BIN
scripts/system/assets/images/ignore-target.png
Normal file
BIN
scripts/system/assets/images/ignore-target.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 30 23.1" style="enable-background:new 0 0 30 23.1;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#414042;}
|
||||
.st1{fill:#EF3B4E;}
|
||||
.st2{fill:#FFFFFF;}
|
||||
</style>
|
||||
<polygon class="st0" points="12.2,12 15.4,22.1 18,12 "/>
|
||||
<polygon class="st1" points="12,11.7 15.1,21.8 17.8,11.7 "/>
|
||||
<path class="st0" d="M1.3,1.8H29c0.4,0,0.7,0.3,0.7,0.7v6c0,0.4-0.3,0.7-0.7,0.7H1.3c-0.4,0-0.7-0.3-0.7-0.7v-6
|
||||
C0.6,2.1,0.9,1.8,1.3,1.8z"/>
|
||||
<path class="st1" d="M1.1,1.5h27.7c0.4,0,0.7,0.3,0.7,0.7v6c0,0.4-0.3,0.7-0.7,0.7H1.1c-0.4,0-0.7-0.3-0.7-0.7v-6
|
||||
C0.3,1.8,0.7,1.5,1.1,1.5z"/>
|
||||
<path class="st0" d="M3.8,7.6V3.4h0.8v4.3H3.8z"/>
|
||||
<path class="st0" d="M8.5,7.1C8.2,7.5,7.8,7.7,7.4,7.7c-0.3,0-0.5-0.1-0.8-0.2C6.4,7.3,6.2,7.2,6,7C5.8,6.8,5.7,6.6,5.6,6.3
|
||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-0.3,0.2-0.4,0.3c-0.1,0.1-0.2,0.3-0.2,0.5C15.2,5,15.2,5.2,15.2,5.3z"/>
|
||||
<path class="st2" d="M19.2,7.4V3.2H21c0.2,0,0.4,0,0.5,0.1c0.2,0.1,0.3,0.2,0.5,0.3c0.1,0.1,0.2,0.3,0.3,0.5
|
||||
c0.1,0.2,0.1,0.3,0.1,0.5c0,0.3-0.1,0.5-0.2,0.8c-0.1,0.2-0.3,0.4-0.6,0.5l1,1.6h-0.9L20.8,6H20v1.4H19.2z M20,5.3h1
|
||||
c0.1,0,0.1,0,0.2-0.1c0.1,0,0.1-0.1,0.2-0.2c0-0.1,0.1-0.1,0.1-0.2c0-0.1,0-0.2,0-0.3c0-0.1,0-0.2,0-0.3c0-0.1-0.1-0.2-0.1-0.2
|
||||
C21.3,4.1,21.2,4,21.2,4c-0.1,0-0.1,0-0.2-0.1h-1V5.3z"/>
|
||||
<path class="st2" d="M26.3,6.7v0.7h-3V3.2h2.9v0.7h-2v1H26v0.7h-1.8v1.1C24.2,6.7,26.3,6.7,26.3,6.7z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 4.6 KiB |
BIN
scripts/system/assets/images/kick-target.png
Normal file
BIN
scripts/system/assets/images/kick-target.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 30 23.1" style="enable-background:new 0 0 30 23.1;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#414042;}
|
||||
.st1{fill:#EF3B4E;}
|
||||
.st2{fill:#FFFFFF;}
|
||||
</style>
|
||||
<path class="st0" d="M1.3,1.7H29c0.4,0,0.7,0.3,0.7,0.7v6c0,0.4-0.3,0.7-0.7,0.7H1.3c-0.4,0-0.7-0.3-0.7-0.7v-6
|
||||
C0.6,2,0.9,1.7,1.3,1.7z"/>
|
||||
<polygon class="st0" points="12.2,12 15.4,22.1 18,12 "/>
|
||||
<path class="st1" d="M1.1,1.4h27.7c0.4,0,0.7,0.3,0.7,0.7v6c0,0.4-0.3,0.7-0.7,0.7H1.1c-0.4,0-0.7-0.3-0.7-0.7v-6
|
||||
C0.3,1.7,0.7,1.4,1.1,1.4z"/>
|
||||
<path class="st0" d="M8.2,7.1V3H9v2l1.8-2h0.8L10,4.8l1.7,2.3h-0.8L9.6,5.2L9,5.8v1.2H8.2z"/>
|
||||
<path class="st0" d="M12.2,7.1V3H13v4.1H12.2L12.2,7.1z"/>
|
||||
<path class="st0" d="M13.8,5c0-0.3,0-0.5,0.1-0.7C14,4,14.1,3.8,14.3,3.6c0.2-0.2,0.4-0.4,0.6-0.5c0.3-0.1,0.5-0.2,0.8-0.2
|
||||
c0.4,0,0.7,0.1,1,0.2c0.3,0.2,0.5,0.4,0.6,0.6l-0.6,0.4c0-0.1-0.1-0.2-0.2-0.3c-0.1-0.1-0.1-0.1-0.2-0.2c-0.1,0-0.2-0.1-0.3-0.1
|
||||
c-0.1,0-0.2,0-0.3,0c-0.2,0-0.3,0-0.5,0.1C15.1,3.9,15,4,14.9,4.1c-0.1,0.1-0.2,0.3-0.2,0.4c0,0.2-0.1,0.3-0.1,0.5
|
||||
c0,0.2,0,0.4,0.1,0.5c0.1,0.2,0.1,0.3,0.2,0.4c0.1,0.1,0.2,0.2,0.4,0.3c0.1,0.1,0.3,0.1,0.5,0.1c0.1,0,0.1,0,0.2,0
|
||||
c0.2,0,0.4-0.2,0.5-0.3c0.1-0.1,0.1-0.2,0.2-0.3l0.6,0.4c-0.1,0.2-0.2,0.3-0.3,0.4c-0.1,0.1-0.3,0.2-0.4,0.3C16.5,7,16.4,7,16.2,7.1
|
||||
c-0.2,0-0.3,0.1-0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2" d="M17.9,6.9V2.8h0.8v2l1.8-2h0.8l-1.6,1.8l1.7,2.3h-0.8l-1.3-1.8l-0.5,0.6v1.2C18.7,6.9,17.9,6.9,17.9,6.9z"/>
|
||||
<polygon class="st1" points="12,11.7 15.1,21.8 17.8,11.7 "/>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.7 KiB |
|
@ -64,7 +64,7 @@ function buttonClicked(){
|
|||
button.clicked.connect(buttonClicked);
|
||||
|
||||
function overlayURL() {
|
||||
return Script.resolvePath("assets/images/" + (Users.canKick ? "kick-target.svg" : "ignore-target.svg"));
|
||||
return Script.resolvePath("assets/images/" + (Users.canKick ? "kick-target.png" : "ignore-target.png"));
|
||||
}
|
||||
|
||||
function updateOverlays() {
|
||||
|
@ -104,7 +104,7 @@ function updateOverlays() {
|
|||
var newOverlay = Overlays.addOverlay("image3d", {
|
||||
url: overlayURL(),
|
||||
position: overlayPosition,
|
||||
size: 0.4,
|
||||
size: 1,
|
||||
scale: 0.4,
|
||||
color: { red: 255, green: 255, blue: 255},
|
||||
alpha: 1,
|
||||
|
@ -179,14 +179,8 @@ Controller.mousePressEvent.connect(function(event){
|
|||
// But we dont' get mousePressEvents.
|
||||
var triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click');
|
||||
|
||||
var TRIGGER_GRAB_VALUE = 0.85; // From handControllerGrab/Pointer.js. Should refactor.
|
||||
var TRIGGER_ON_VALUE = 0.4;
|
||||
var TRIGGER_OFF_VALUE = 0.15;
|
||||
var triggered = false;
|
||||
var activeHand = Controller.Standard.RightHand;
|
||||
|
||||
function controllerComputePickRay() {
|
||||
var controllerPose = Controller.getPoseValue(activeHand);
|
||||
function controllerComputePickRay(hand) {
|
||||
var controllerPose = Controller.getPoseValue(hand);
|
||||
if (controllerPose.valid && triggered) {
|
||||
var controllerPosition = Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, controllerPose.translation),
|
||||
MyAvatar.position);
|
||||
|
@ -196,31 +190,21 @@ function controllerComputePickRay() {
|
|||
}
|
||||
}
|
||||
|
||||
function makeTriggerHandler(hand) {
|
||||
function makeClickHandler(hand) {
|
||||
return function (value) {
|
||||
if (isShowingOverlays) {
|
||||
if (!triggered && (value > TRIGGER_GRAB_VALUE)) { // should we smooth?
|
||||
triggered = true;
|
||||
if (activeHand !== hand) {
|
||||
// No switching while the other is already triggered, so no need to release.
|
||||
activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;
|
||||
var pickRay = controllerComputePickRay(hand);
|
||||
if (pickRay) {
|
||||
var overlayIntersection = Overlays.findRayIntersection(pickRay);
|
||||
if (overlayIntersection.intersects) {
|
||||
handleSelectedOverlay(overlayIntersection);
|
||||
}
|
||||
|
||||
var pickRay = controllerComputePickRay();
|
||||
if (pickRay) {
|
||||
var overlayIntersection = Overlays.findRayIntersection(pickRay);
|
||||
if (overlayIntersection.intersects) {
|
||||
handleSelectedOverlay(overlayIntersection);
|
||||
}
|
||||
}
|
||||
} else if (triggered && (value < TRIGGER_OFF_VALUE)) {
|
||||
triggered = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
triggerMapping.from(Controller.Standard.RT).peek().to(makeTriggerHandler(Controller.Standard.RightHand));
|
||||
triggerMapping.from(Controller.Standard.LT).peek().to(makeTriggerHandler(Controller.Standard.LeftHand));
|
||||
triggerMapping.from(Controller.Standard.RTClick).peek().to(makeClickHandler(Controller.Standard.RightHand));
|
||||
triggerMapping.from(Controller.Standard.LTClick).peek().to(makeClickHandler(Controller.Standard.LeftHand));
|
||||
|
||||
triggerMapping.enable();
|
||||
|
||||
|
|
Loading…
Reference in a new issue