add teleport models etc

This commit is contained in:
James B. Pollack 2016-07-05 10:31:47 -07:00
parent ac99ec04d0
commit 056e9e3a72
3 changed files with 90 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View file

@ -15,8 +15,8 @@
//try moving to final destination in 4 steps: 50% 75% 90% 100% (arrival)
//terminate the line when there is an intersection
//when there's not an intersection, set a fixed distance?
//terminate the line when there is an intersection (moving away from lines so...)
//when there's not an intersection, set a fixed distance? (no)
//v2: show room boundaries when choosing a place to teleport
//v2: smooth fade screen in/out?
@ -24,6 +24,13 @@
var inTeleportMode = false;
var currentFadeSphereOpacity = 1;
var fadeSphereInterval = null;
//milliseconds between fading one-tenth -- so this is a one second fade total
var FADE_IN_INTERVAL = 100;
var FADE_OUT_INTERVAL = 100;
var BEAM_MODEL_URL = "http://hifi-content.s3.amazonaws.com/james/teleporter/teleportBeam.fbx";
var TARGET_MODEL_URL = 'http://hifi-content.s3.amazonaws.com/james/teleporter/Tele-destiny.fbx';
var TARGET_MODEL_DIMENSIONS = {
@ -117,6 +124,87 @@ function Teleporter() {
};
this.createStretchyBeam = function() {
var beamProps = {
url: BEAM_MODEL_URL,
position: MyAvatar.position,
rotation: towardsMe,
dimensions: TARGET_MODEL_DIMENSIONS
};
_this.stretchyBeam = Overlays.addOverlay("model", beamProps);
};
this.createFadeSphere = function(avatarHead) {
var sphereProps = {
// rotation: props.rotation,
position: avatarHead,
size: 0.25,
color: {
red: 0,
green: 0,
blue: 0,
},
alpha: 1,
solid: true,
visible: true,
ignoreRayIntersection: true,
drawInFront: true
};
currentFadeSphereOpacity = 1;
_this.fadeSphere = Overlays.addOverlay("sphere", sphereProps);
};
this.fadeSphereOut = function() {
fadeSphereInterval = Script.setInterval(function() {
if (currentFadeSphereOpacity === 0) {
Script.clearInterval(fadeSphereInterval);
fadeSphereInterval = null;
return;
}
if (currentFadeSphereOpacity > 0) {
currentFadeSphereOpacity -= 0.1;
}
Overlays.editOverlay(_this.fadeSphere, {
opacity: currentFadeSphereOpacity
})
}, FADE_OUT_INTERVAL)
};
this.fadeSphereIn = function() {
fadeSphereInterval = Script.setInterval(function() {
if (currentFadeSphereOpacity === 1) {
Script.clearInterval(fadeSphereInterval);
fadeSphereInterval = null;
return;
}
if (currentFadeSphereOpacity < 1) {
currentFadeSphereOpacity += 0.1;
}
Overlays.editOverlay(_this.fadeSphere, {
opacity: currentFadeSphereOpacity
})
}, FADE_IN_INTERVAL);
};
this.deleteFadeSphere = function() {
Overlays.deleteOverlay(_this.fadeSphere);
};
this.updateStretchyBeam = function() {
};
this.deleteStretchyBeam = function() {
Overlays.deleteOverlay(_this.stretchyBeam);
};
this.exitTeleportMode = function(value) {
print('jbp value on exit: ' + value);
Script.update.disconnect(this.update);