added isLocked() to lock the ground plane in hq

This commit is contained in:
ZappoMan 2014-05-18 20:31:55 -07:00
parent 0c4727d459
commit 31ae7ceaff

View file

@ -117,7 +117,11 @@ function controller(wichSide) {
this.grab = function (modelID, properties) { this.grab = function (modelID, properties) {
if (this.isLocked(properties)) {
print("Model locked " + modelID.id);
} else {
print("Grabbing " + modelID.id); print("Grabbing " + modelID.id);
this.grabbing = true; this.grabbing = true;
this.modelID = modelID; this.modelID = modelID;
@ -125,6 +129,7 @@ function controller(wichSide) {
this.oldModelRotation = properties.modelRotation; this.oldModelRotation = properties.modelRotation;
this.oldModelRadius = properties.radius; this.oldModelRadius = properties.radius;
} }
}
this.release = function () { this.release = function () {
this.grabbing = false; this.grabbing = false;
@ -145,7 +150,23 @@ function controller(wichSide) {
} }
} }
this.isLocked = function (properties) {
// special case to lock the ground plane model in hq.
if (location.hostname == "hq.highfidelity.io" &&
properties.modelURL == "https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/Terrain_Reduce_forAlpha.fbx") {
return true;
}
return false;
}
this.checkModel = function (properties) { this.checkModel = function (properties) {
// special case to lock the ground plane model in hq.
if (location.hostname == "hq.highfidelity.io" &&
properties.modelURL == "https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/Terrain_Reduce_forAlpha.fbx") {
return { valid: false };
}
// P P - Model // P P - Model
// /| A - Palm // /| A - Palm
// / | d B - unit vector toward tip // / | d B - unit vector toward tip
@ -285,8 +306,10 @@ function controller(wichSide) {
} }
var properties = Models.getModelProperties(foundModels[i]); var properties = Models.getModelProperties(foundModels[i]);
if (this.isLocked(properties)) {
print("Model locked " + properties.id);
} else {
print("Checking properties: " + properties.id + " " + properties.isKnownID); print("Checking properties: " + properties.id + " " + properties.isKnownID);
var check = this.checkModel(properties); var check = this.checkModel(properties);
if (check.valid) { if (check.valid) {
this.grab(foundModels[i], properties); this.grab(foundModels[i], properties);
@ -298,6 +321,7 @@ function controller(wichSide) {
} }
} }
} }
}
this.cleanup = function () { this.cleanup = function () {
Overlays.deleteOverlay(this.laser); Overlays.deleteOverlay(this.laser);
@ -463,8 +487,10 @@ function mousePressEvent(event) {
} }
var properties = Models.getModelProperties(foundModels[i]); var properties = Models.getModelProperties(foundModels[i]);
if (this.isLocked(properties)) {
print("Model locked " + properties.id);
} else {
print("Checking properties: " + properties.id + " " + properties.isKnownID); print("Checking properties: " + properties.id + " " + properties.isKnownID);
// P P - Model // P P - Model
// /| A - Palm // /| A - Palm
// / | d B - unit vector toward tip // / | d B - unit vector toward tip
@ -505,13 +531,14 @@ function mousePressEvent(event) {
orientation = MyAvatar.orientation; orientation = MyAvatar.orientation;
intersection = rayPlaneIntersection(pickRay, P, Quat.getFront(orientation)); intersection = rayPlaneIntersection(pickRay, P, Quat.getFront(orientation));
print("Clicked on " + selectedModelID.id + " " + modelSelected);
print("Clicked on " + selectedModelID.id + " " + modelSelected);
return; return;
} }
} }
} }
} }
}
var oldModifier = 0; var oldModifier = 0;
var modifier = 0; var modifier = 0;