mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 12:14:00 +02:00
make requested changes
This commit is contained in:
parent
54c3f48e65
commit
ba9d5d18bc
6 changed files with 93 additions and 10 deletions
|
@ -489,7 +489,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
|||
entityID: this.targetEntityID
|
||||
};
|
||||
|
||||
Messages.sendMessage('Hifi-unhighlight-entity', JSON.stringify(message));
|
||||
Messages.sendLocalMessage('Hifi-unhighlight-entity', JSON.stringify(message));
|
||||
var grabbedProperties = Entities.getEntityProperties(this.targetEntityID);
|
||||
|
||||
// if an object is "equipped" and has a predefined offset, use it.
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
//
|
||||
// highlightNearbyEntities.js
|
||||
//
|
||||
// Created by Dante Ruiz 2018-4-10
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
|
@ -12,6 +14,8 @@
|
|||
DEFAULT_SEARCH_SPHERE_DISTANCE, getGrabbableData, makeLaserParams, entityIsCloneable, Messages, print
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
(function () {
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
Script.include("/~/system/libraries/controllers.js");
|
||||
|
@ -40,15 +44,16 @@
|
|||
|
||||
|
||||
this.isGrabable = function(controllerData, props) {
|
||||
var entityIsGrabable = false;
|
||||
if (dispatcherUtils.entityIsGrabbable(props) || entityIsCloneable(props)) {
|
||||
// if we've attempted to grab a child, roll up to the root of the tree
|
||||
var groupRootProps = dispatcherUtils.findGroupParent(controllerData, props);
|
||||
if (dispatcherUtils.entityIsGrabbable(groupRootProps)) {
|
||||
return true;
|
||||
entityIsGrabable = true;
|
||||
if (!dispatcherUtils.entityIsGrabbable(groupRootProps)) {
|
||||
entityIsGrabable = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return entityIsGrabable;
|
||||
};
|
||||
|
||||
this.hasHyperLink = function(props) {
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
//
|
||||
// mouseHighlightEntities.js
|
||||
//
|
||||
// scripts/system/controllers/controllerModules/
|
||||
//
|
||||
// Created by Dante Ruiz 2018-4-11
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
/* jslint bitwise: true */
|
||||
|
||||
/* global Script, print, Entities, Picks, HMD */
|
||||
|
||||
|
||||
(function() {
|
||||
var dispatcherUtils = Script.require("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
||||
function MouseHighlightEntities() {
|
||||
this.highlightedEntity = null;
|
||||
|
||||
this.parameters = dispatcherUtils.makeDispatcherModuleParameters(
|
||||
5,
|
||||
["mouse"],
|
||||
[],
|
||||
100);
|
||||
|
||||
this.isReady = function(controllerData) {
|
||||
if (HMD.active) {
|
||||
print("????");
|
||||
if (this.highlightedEntity) {
|
||||
// unhighlight entity
|
||||
}
|
||||
} else {
|
||||
var pickResult = controllerData.mouseRayPick;
|
||||
if (pickResult.type === Picks.INTERSECTED_ENTITY) {
|
||||
var targetEntityID = pickResult.objectID;
|
||||
|
||||
if (this.highlightedEntity !== targetEntityID) {
|
||||
var targetProps = Entities.getEntityProperties(targetEntityID, [
|
||||
"dynamic", "shapeType", "position",
|
||||
"rotation", "dimensions", "density",
|
||||
"userData", "locked", "type", "href"
|
||||
]);
|
||||
|
||||
if (this.highlightedEntity) {
|
||||
dispatcherUtils.unhighlightTargetEntity(this.highlightedEntity);
|
||||
this.highlightedEntity = null;
|
||||
}
|
||||
|
||||
if (dispatcherUtils.entityIsGrabbable(targetProps)) {
|
||||
// highlight entity
|
||||
dispatcherUtils.highlightTargetEntity(targetEntityID);
|
||||
this.highlightedEntity = targetEntityID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dispatcherUtils.makeRunningValues(false, [], []);
|
||||
};
|
||||
|
||||
this.run = function(controllerData) {
|
||||
return this.isReady(controllerData);
|
||||
};
|
||||
}
|
||||
|
||||
var mouseHighlightEntities = new MouseHighlightEntities();
|
||||
dispatcherUtils.enableDispatcherModule("MouseHighlightEntities", mouseHighlightEntities);
|
||||
|
||||
function cleanup() {
|
||||
dispatcherUtils.disableDispatcherModule("MouseHighlightEntities");
|
||||
}
|
||||
Script.scriptEnding.connect(cleanup);
|
||||
})();
|
|
@ -120,7 +120,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
entityID: this.targetEntityID
|
||||
};
|
||||
|
||||
Messages.sendMessage('Hifi-unhighlight-entity', JSON.stringify(message));
|
||||
Messages.sendLocalMessage('Hifi-unhighlight-entity', JSON.stringify(message));
|
||||
};
|
||||
|
||||
// this is for when the action is going to time-out
|
||||
|
|
|
@ -95,7 +95,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
entityID: this.targetEntityID
|
||||
};
|
||||
|
||||
Messages.sendMessage('Hifi-unhighlight-entity', JSON.stringify(message));
|
||||
Messages.sendLocalMessage('Hifi-unhighlight-entity', JSON.stringify(message));
|
||||
var handJointIndex;
|
||||
// if (this.ignoreIK) {
|
||||
// handJointIndex = this.controllerJointIndex;
|
||||
|
|
|
@ -33,7 +33,8 @@ var CONTOLLER_SCRIPTS = [
|
|||
"controllerModules/mouseHMD.js",
|
||||
"controllerModules/scaleEntity.js",
|
||||
"controllerModules/highlightNearbyEntities.js",
|
||||
"controllerModules/nearGrabHyperLinkEntity.js"
|
||||
"controllerModules/nearGrabHyperLinkEntity.js",
|
||||
"controllerModules/mouseHighlightEntities.js"
|
||||
];
|
||||
|
||||
var DEBUG_MENU_ITEM = "Debug defaultScripts.js";
|
||||
|
|
Loading…
Reference in a new issue