reverting file

This commit is contained in:
Dante Ruiz 2018-04-09 16:51:20 -07:00
parent 2c20593b6d
commit 1113202a90

View file

@ -23,28 +23,6 @@ var DEFAULT_SPHERE_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/eq
var EQUIP_SPHERE_SCALE_FACTOR = 0.65;
var EQUIPPING_OUTER_COLOR = { red: 0, green: 100, blue: 0 };
var EQUIPPING_INNER_COLOR = { red: 0, green: 150, blue: 0 };
var UNEQUIPPING_OUTER_COLOR = { red: 100, green: 0, blue: 0 };
var UNEQUIPPING_INNER_COLOR = { red: 150, green: 0, blue: 0 };
var CIRCLE_3D_PROPERTIES = {
solid: true,
visible: false,
innerRadius: 0.0,
outerRadius: 1.0,
startAt: 0,
endAt: 180,
outerColor: EQUIPPING_OUTER_COLOR,
innerColor: EQUIPPING_INNER_COLOR,
alpha: 1.0,
innerAlpha: 0.9,
Alpha: 1.0
};
var EQUIP_TIME = 3000;
var UNEQUIP_TIME = 4000;
// Each overlayInfoSet describes a single equip hotspot.
// It is an object with the following keys:
// timestamp - last time this object was updated, used to delete stale hotspot overlays.
@ -180,69 +158,6 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
}
};
function EquipTimer(hand) {
this.hand = hand;
this.timelapsed = 0;
this.primaryTriggerPressed = false;
this.secondaryTriggerPressed = false;
this.targetTime = EQUIP_TIME;
this.finished = false;
this.circle3dProperties = CIRCLE_3D_PROPERTIES;
this.circle3dOverlay = Overlays.addOverlay("circle3d", this.circle3dProperties);
}
EquipTimer.prototype.update = function(deltaTime, targetEntityID, controllerData) {
var TRIGGER_ON_VALUE = 0.105;
var BUMPER_ON_VALUE = 0.5;
var primaryTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_ON_VALUE;
var secondaryTriggerPressed = controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE;
if (primaryTriggerPressed || secondaryTriggerPressed) {
if ((primaryTriggerPressed === this.primaryTriggerPressed) &&
(secondaryTriggerPressed === this.secondaryTriggerPressed)) {
this.timelapsed += deltaTime * 1000; // convert to ms
// update overlay
var entityProperties = Entities.getEntityProperties(targetEntityID, ["position", "rotation"]);
if (entityProperties) {
var PI = 3.14159;
var TWO_PI = PI * 2;
var FORWARD_OFFSET = 0.1 * MyAvatar.sensorToWorldScale;
var direction = Vec3.subtract(entityProperties.position - HMD.position);
var overlayPosition = Vec3.sum(entityProperties.position, Vec3.multiply(FORWARD_OFFSET, direction));
}
if (this.timelapsed >= this.targetTime) {
print("finished");
this.finished = true;
}
return;
}
this.reset();
this.primaryTriggerPressed = primaryTriggerPressed;
this.secondaryTriggerPressed = secondaryTriggerPressed;
} else {
this.reset();
}
};
EquipTimer.prototype.done = function() {
return this.finished;
};
EquipTimer.prototype.reset = function() {
this.finished = false;
this.timelapsed = 0;
this.primaryTriggerPressed = false;
this.secondaryTriggerPressed = false;
};
EquipTimer.prototype.cleanup = function() {
Overlays.deleteOverlay(this.circle3dOverlay);
};
(function() {
var ATTACH_POINT_SETTINGS = "io.highfidelity.attachPoints";
@ -355,7 +270,6 @@ EquipTimer.prototype.cleanup = function() {
this.shouldSendStart = false;
this.equipedWithSecondary = false;
this.handHasBeenRightsideUp = false;
this.equipAtRun = false;
this.parameters = makeDispatcherModuleParameters(
300,
@ -365,8 +279,6 @@ EquipTimer.prototype.cleanup = function() {
var equipHotspotBuddy = new EquipHotspotBuddy();
this.equipTimer = new EquipTimer(this.hand);
this.setMessageGrabData = function(entityProperties) {
if (entityProperties) {
this.messageGrabEntity = true;
@ -704,23 +616,20 @@ EquipTimer.prototype.cleanup = function() {
}
equipHotspotBuddy.update(deltaTime, timestamp, controllerData);
// if the potentialHotspot is cloneable, clone it and return it
// if the potentialHotspot os not cloneable and locked return null
if (potentialEquipHotspot &&
(((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) || this.messageGrabEntity)) {
(((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) ||
this.messageGrabEntity)) {
this.grabbedHotspot = potentialEquipHotspot;
this.targetEntityID = this.grabbedHotspot.entityID;
this.equipAtRun = true;
this.startEquipEntity(controllerData);
this.messageGrabEntity = false;
if (this.messageGrabEntity) {
this.startEquipEntity(controllerData);
this.equipedWithSecondary = this.secondarySmoothedSqueezed();
this.equipAtRun = false;
}
this.equipedWithSecondary = this.secondarySmoothedSqueezed();
return makeRunningValues(true, [potentialEquipHotspot.entityID], []);
} else {
this.equipAtRun = false;
return makeRunningValues(false, [], []);
}
};
@ -741,19 +650,6 @@ EquipTimer.prototype.cleanup = function() {
var timestamp = Date.now();
this.updateInputs(controllerData);
if (this.equipAtRun) {
if ((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) {
this.equipTimer.update(deltaTime, this.targetEntityID, controllerData);
if (this.equipTimer.done()) {
this.equipAtRun = false;
this.startEquipEntity(controllerData);
this.equipedWithSecondary = this.secondarySmoothedSqueezed();
this.equipTimer.reset();
}
return makeRunningValues(true, [], []);
}
}
if (!this.isTargetIDValid(controllerData)) {
this.endEquipEntity();
return makeRunningValues(false, [], []);