mirror of
https://github.com/lubosz/overte.git
synced 2025-04-07 15:22:09 +02:00
Improvement in controller scripts performance
This commit is contained in:
parent
6265949688
commit
5b9fb821de
5 changed files with 12 additions and 12 deletions
|
@ -190,7 +190,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
var worldToSensorMat = Mat4.inverse(MyAvatar.getSensorToWorldMatrix());
|
||||
var roomControllerPosition = Mat4.transformPoint(worldToSensorMat, worldControllerPosition);
|
||||
|
||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedThingID, DISPATCHER_PROPERTIES);
|
||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedThingID, "position");
|
||||
var now = Date.now();
|
||||
var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds
|
||||
this.currentObjectTime = now;
|
||||
|
@ -306,7 +306,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.notPointingAtEntity = function(controllerData) {
|
||||
var intersection = controllerData.rayPicks[this.hand];
|
||||
var entityProperty = Entities.getEntityProperties(intersection.objectID, DISPATCHER_PROPERTIES);
|
||||
var entityProperty = Entities.getEntityProperties(intersection.objectID, "type");
|
||||
var entityType = entityProperty.type;
|
||||
var hudRayPick = controllerData.hudRayPicks[this.hand];
|
||||
var point2d = this.calculateNewReticlePosition(hudRayPick.intersection);
|
||||
|
@ -341,7 +341,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
var worldControllerPosition = controllerLocation.position;
|
||||
var worldControllerRotation = controllerLocation.orientation;
|
||||
|
||||
var grabbedProperties = Entities.getEntityProperties(intersection.objectID, DISPATCHER_PROPERTIES);
|
||||
var grabbedProperties = Entities.getEntityProperties(intersection.objectID, "position");
|
||||
this.currentObjectPosition = grabbedProperties.position;
|
||||
this.grabRadius = intersection.distance;
|
||||
|
||||
|
@ -355,7 +355,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
};
|
||||
|
||||
this.targetIsNull = function() {
|
||||
var properties = Entities.getEntityProperties(this.grabbedThingID, DISPATCHER_PROPERTIES);
|
||||
var properties = Entities.getEntityProperties(this.grabbedThingID, "type");
|
||||
if (Object.keys(properties).length === 0 && this.distanceHolding) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
var worldToSensorMat = Mat4.inverse(MyAvatar.getSensorToWorldMatrix());
|
||||
var roomControllerPosition = Mat4.transformPoint(worldToSensorMat, worldControllerPosition);
|
||||
|
||||
var targetProps = Entities.getEntityProperties(this.targetEntityID, DISPATCHER_PROPERTIES);
|
||||
var targetProps = Entities.getEntityProperties(this.targetEntityID, "position");
|
||||
var now = Date.now();
|
||||
var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds
|
||||
this.currentObjectTime = now;
|
||||
|
@ -358,7 +358,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.notPointingAtEntity = function (controllerData) {
|
||||
var intersection = controllerData.rayPicks[this.hand];
|
||||
var entityProperty = Entities.getEntityProperties(intersection.objectID, DISPATCHER_PROPERTIES);
|
||||
var entityProperty = Entities.getEntityProperties(intersection.objectID, "type");
|
||||
var entityType = entityProperty.type;
|
||||
var hudRayPick = controllerData.hudRayPicks[this.hand];
|
||||
var point2d = this.calculateNewReticlePosition(hudRayPick.intersection);
|
||||
|
@ -370,7 +370,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
};
|
||||
|
||||
this.targetIsNull = function () {
|
||||
var properties = Entities.getEntityProperties(this.targetEntityID, DISPATCHER_PROPERTIES);
|
||||
var properties = Entities.getEntityProperties(this.targetEntityID, "type");
|
||||
if (Object.keys(properties).length === 0 && this.distanceHolding) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
|
||||
if (!props) {
|
||||
props = Entities.getEntityProperties(this.targetEntityID, DISPATCHER_PROPERTIES);
|
||||
props = Entities.getEntityProperties(this.targetEntityID, "type");
|
||||
if (!props) {
|
||||
// entity was deleted
|
||||
this.grabbing = false;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
/* global Script, Entities, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
|
||||
makeDispatcherModuleParameters, Overlays, HMD, TRIGGER_ON_VALUE, TRIGGER_OFF_VALUE, getEnabledModuleByName,
|
||||
Picks, makeLaserParams, Settings, MyAvatar, RIGHT_HAND, LEFT_HAND, DISPATCHER_PROPERTIES
|
||||
Picks, makeLaserParams, Settings, MyAvatar, RIGHT_HAND, LEFT_HAND
|
||||
*/
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
@ -164,7 +164,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
return type;
|
||||
}
|
||||
} else if (intersection.type === Picks.INTERSECTED_ENTITY) {
|
||||
var entityProperties = Entities.getEntityProperties(objectID, DISPATCHER_PROPERTIES);
|
||||
var entityProperties = Entities.getEntityProperties(objectID, ["type","locked"]);
|
||||
var entityType = entityProperties.type;
|
||||
var isLocked = entityProperties.locked;
|
||||
if (entityType === "Web" && (!isLocked || triggerPressed)) {
|
||||
|
|
|
@ -311,7 +311,7 @@ Grabber.prototype.pressEvent = function(event) {
|
|||
mouse.startDrag(event);
|
||||
|
||||
var clickedEntity = pickResults.objectID;
|
||||
var entityProperties = Entities.getEntityProperties(clickedEntity, DISPATCHER_PROPERTIES);
|
||||
var entityProperties = Entities.getEntityProperties(clickedEntity, ["position", "rotation", "dimensions"]);
|
||||
this.startPosition = entityProperties.position;
|
||||
this.lastRotation = entityProperties.rotation;
|
||||
var cameraPosition = Camera.getPosition();
|
||||
|
@ -422,7 +422,7 @@ Grabber.prototype.moveEvent = function(event) {
|
|||
|
||||
Grabber.prototype.moveEventProcess = function() {
|
||||
this.moveEventTimer = null;
|
||||
var entityProperties = Entities.getEntityProperties(this.entityID, DISPATCHER_PROPERTIES);
|
||||
var entityProperties = Entities.getEntityProperties(this.entityID, "position");
|
||||
if (!entityProperties || HMD.active) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue