mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 10:39:54 +02:00
Merge remote-tracking branch 'SamGondelman/parabolic' into M17217-a
This commit is contained in:
commit
cf12124b34
2 changed files with 25 additions and 53 deletions
Binary file not shown.
|
@ -22,7 +22,6 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
var TARGET_MODEL_URL = Script.resolvePath("../../assets/models/teleport-destination.fbx");
|
var TARGET_MODEL_URL = Script.resolvePath("../../assets/models/teleport-destination.fbx");
|
||||||
var TOO_CLOSE_MODEL_URL = Script.resolvePath("../../assets/models/teleport-cancel.fbx");
|
|
||||||
var SEAT_MODEL_URL = Script.resolvePath("../../assets/models/teleport-seat.fbx");
|
var SEAT_MODEL_URL = Script.resolvePath("../../assets/models/teleport-seat.fbx");
|
||||||
|
|
||||||
var TARGET_MODEL_DIMENSIONS = {
|
var TARGET_MODEL_DIMENSIONS = {
|
||||||
|
@ -49,8 +48,6 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
blue: 73
|
blue: 73
|
||||||
};
|
};
|
||||||
|
|
||||||
var COOL_IN_DURATION = 300;
|
|
||||||
|
|
||||||
var handInfo = {
|
var handInfo = {
|
||||||
right: {
|
right: {
|
||||||
controllerInput: Controller.Standard.RightHand
|
controllerInput: Controller.Standard.RightHand
|
||||||
|
@ -61,37 +58,19 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
};
|
};
|
||||||
|
|
||||||
var cancelPath = {
|
var cancelPath = {
|
||||||
type: "line3d",
|
|
||||||
color: COLORS_TELEPORT_CANCEL,
|
color: COLORS_TELEPORT_CANCEL,
|
||||||
ignorePickIntersection: true,
|
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
solid: true,
|
width: 0.025
|
||||||
drawInFront: true,
|
|
||||||
glow: 1.0
|
|
||||||
};
|
};
|
||||||
var teleportPath = {
|
var teleportPath = {
|
||||||
type: "line3d",
|
|
||||||
color: COLORS_TELEPORT_CAN_TELEPORT,
|
color: COLORS_TELEPORT_CAN_TELEPORT,
|
||||||
ignorePickIntersection: true,
|
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
solid: true,
|
width: 0.025
|
||||||
drawInFront: true,
|
|
||||||
glow: 1.0
|
|
||||||
};
|
};
|
||||||
var seatPath = {
|
var seatPath = {
|
||||||
type: "line3d",
|
|
||||||
color: COLORS_TELEPORT_SEAT,
|
color: COLORS_TELEPORT_SEAT,
|
||||||
ignorePickIntersection: true,
|
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
solid: true,
|
width: 0.025
|
||||||
drawInFront: true,
|
|
||||||
glow: 1.0
|
|
||||||
};
|
|
||||||
var cancelEnd = {
|
|
||||||
type: "model",
|
|
||||||
url: TOO_CLOSE_MODEL_URL,
|
|
||||||
dimensions: TARGET_MODEL_DIMENSIONS,
|
|
||||||
ignorePickIntersection: true
|
|
||||||
};
|
};
|
||||||
var teleportEnd = {
|
var teleportEnd = {
|
||||||
type: "model",
|
type: "model",
|
||||||
|
@ -107,20 +86,18 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd},
|
var teleportRenderStates = [{name: "cancel", path: cancelPath},
|
||||||
{name: "teleport", path: teleportPath, end: teleportEnd},
|
{name: "teleport", path: teleportPath, end: teleportEnd},
|
||||||
{name: "seat", path: seatPath, end: seatEnd}];
|
{name: "seat", path: seatPath, end: seatEnd}];
|
||||||
|
|
||||||
var DEFAULT_DISTANCE = 50;
|
var DEFAULT_DISTANCE = 8.0;
|
||||||
var teleportDefaultRenderStates = [{name: "cancel", distance: DEFAULT_DISTANCE, path: cancelPath}];
|
var teleportDefaultRenderStates = [{name: "cancel", distance: DEFAULT_DISTANCE, path: cancelPath}];
|
||||||
|
|
||||||
var coolInTimeout = null;
|
|
||||||
var ignoredEntities = [];
|
var ignoredEntities = [];
|
||||||
|
|
||||||
|
|
||||||
var TELEPORTER_STATES = {
|
var TELEPORTER_STATES = {
|
||||||
IDLE: 'idle',
|
IDLE: 'idle',
|
||||||
COOL_IN: 'cool_in',
|
|
||||||
TARGETTING: 'targetting',
|
TARGETTING: 'targetting',
|
||||||
TARGETTING_INVALID: 'targetting_invalid'
|
TARGETTING_INVALID: 'targetting_invalid'
|
||||||
};
|
};
|
||||||
|
@ -133,7 +110,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
SEAT: 'seat' // The current target is a seat
|
SEAT: 'seat' // The current target is a seat
|
||||||
};
|
};
|
||||||
|
|
||||||
var speed = 7.0;
|
var speed = 12.0;
|
||||||
var accelerationAxis = {x: 0.0, y: -5.0, z: 0.0};
|
var accelerationAxis = {x: 0.0, y: -5.0, z: 0.0};
|
||||||
|
|
||||||
function Teleporter(hand) {
|
function Teleporter(hand) {
|
||||||
|
@ -151,8 +128,10 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
return otherModule;
|
return otherModule;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.teleportParabolaHandVisible = Pointers.createPointer(PickType.Ray, {
|
this.teleportParabolaHandVisible = Pointers.createPointer(PickType.Parabola, {
|
||||||
joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
|
joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
|
||||||
|
dirOffset: { x: 0, y: 1, z: 0.1 },
|
||||||
|
posOffset: { x: (_this.hand === RIGHT_HAND) ? 0.03 : -0.03, y: 0.2, z: 0.02 },
|
||||||
filter: Picks.PICK_ENTITIES,
|
filter: Picks.PICK_ENTITIES,
|
||||||
faceAvatar: true,
|
faceAvatar: true,
|
||||||
scaleWithAvatar: true,
|
scaleWithAvatar: true,
|
||||||
|
@ -161,10 +140,13 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
accelerationAxis: accelerationAxis,
|
accelerationAxis: accelerationAxis,
|
||||||
rotateAccelerationWithAvatar: true,
|
rotateAccelerationWithAvatar: true,
|
||||||
renderStates: teleportRenderStates,
|
renderStates: teleportRenderStates,
|
||||||
defaultRenderStates: teleportDefaultRenderStates
|
defaultRenderStates: teleportDefaultRenderStates,
|
||||||
|
maxDistance: 8.0
|
||||||
});
|
});
|
||||||
this.teleportParabolaHandInvisible = Pointers.createPointer(PickType.Ray, {
|
this.teleportParabolaHandInvisible = Pointers.createPointer(PickType.Parabola, {
|
||||||
joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
|
joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
|
||||||
|
dirOffset: { x: 0, y: 1, z: 0.1 },
|
||||||
|
posOffset: { x: (_this.hand === RIGHT_HAND) ? 0.03 : -0.03, y: 0.2, z: 0.02 },
|
||||||
filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
|
filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
|
||||||
faceAvatar: true,
|
faceAvatar: true,
|
||||||
scaleWithAvatar: true,
|
scaleWithAvatar: true,
|
||||||
|
@ -172,9 +154,10 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
speed: speed,
|
speed: speed,
|
||||||
accelerationAxis: accelerationAxis,
|
accelerationAxis: accelerationAxis,
|
||||||
rotateAccelerationWithAvatar: true,
|
rotateAccelerationWithAvatar: true,
|
||||||
renderStates: teleportRenderStates
|
renderStates: teleportRenderStates,
|
||||||
|
maxDistance: 8.0
|
||||||
});
|
});
|
||||||
this.teleportParabolaHeadVisible = Pointers.createPointer(PickType.Ray, {
|
this.teleportParabolaHeadVisible = Pointers.createPointer(PickType.Parabola, {
|
||||||
joint: "Avatar",
|
joint: "Avatar",
|
||||||
filter: Picks.PICK_ENTITIES,
|
filter: Picks.PICK_ENTITIES,
|
||||||
faceAvatar: true,
|
faceAvatar: true,
|
||||||
|
@ -184,9 +167,10 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
accelerationAxis: accelerationAxis,
|
accelerationAxis: accelerationAxis,
|
||||||
rotateAccelerationWithAvatar: true,
|
rotateAccelerationWithAvatar: true,
|
||||||
renderStates: teleportRenderStates,
|
renderStates: teleportRenderStates,
|
||||||
defaultRenderStates: teleportDefaultRenderStates
|
defaultRenderStates: teleportDefaultRenderStates,
|
||||||
|
maxDistance: 8.0
|
||||||
});
|
});
|
||||||
this.teleportParabolaHeadInvisible = Pointers.createPointer(PickType.Ray, {
|
this.teleportParabolaHeadInvisible = Pointers.createPointer(PickType.Parabola, {
|
||||||
joint: "Avatar",
|
joint: "Avatar",
|
||||||
filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
|
filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
|
||||||
faceAvatar: true,
|
faceAvatar: true,
|
||||||
|
@ -195,7 +179,8 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
speed: speed,
|
speed: speed,
|
||||||
accelerationAxis: accelerationAxis,
|
accelerationAxis: accelerationAxis,
|
||||||
rotateAccelerationWithAvatar: true,
|
rotateAccelerationWithAvatar: true,
|
||||||
renderStates: teleportRenderStates
|
renderStates: teleportRenderStates,
|
||||||
|
maxDistance: 8.0
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cleanup = function() {
|
this.cleanup = function() {
|
||||||
|
@ -216,16 +201,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
100);
|
100);
|
||||||
|
|
||||||
this.enterTeleport = function() {
|
this.enterTeleport = function() {
|
||||||
if (coolInTimeout !== null) {
|
this.state = TELEPORTER_STATES.TARGETTING;
|
||||||
Script.clearTimeout(coolInTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.state = TELEPORTER_STATES.COOL_IN;
|
|
||||||
coolInTimeout = Script.setTimeout(function() {
|
|
||||||
if (_this.state === TELEPORTER_STATES.COOL_IN) {
|
|
||||||
_this.state = TELEPORTER_STATES.TARGETTING;
|
|
||||||
}
|
|
||||||
}, COOL_IN_DURATION);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.isReady = function(controllerData, deltaTime) {
|
this.isReady = function(controllerData, deltaTime) {
|
||||||
|
@ -287,11 +263,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
} else if (teleportLocationType === TARGET.INVALID || teleportLocationType === TARGET.INVISIBLE) {
|
} else if (teleportLocationType === TARGET.INVALID || teleportLocationType === TARGET.INVISIBLE) {
|
||||||
this.setTeleportState(mode, "", "cancel");
|
this.setTeleportState(mode, "", "cancel");
|
||||||
} else if (teleportLocationType === TARGET.SURFACE) {
|
} else if (teleportLocationType === TARGET.SURFACE) {
|
||||||
if (this.state === TELEPORTER_STATES.COOL_IN) {
|
this.setTeleportState(mode, "teleport", "");
|
||||||
this.setTeleportState(mode, "cancel", "");
|
|
||||||
} else {
|
|
||||||
this.setTeleportState(mode, "teleport", "");
|
|
||||||
}
|
|
||||||
} else if (teleportLocationType === TARGET.SEAT) {
|
} else if (teleportLocationType === TARGET.SEAT) {
|
||||||
this.setTeleportState(mode, "", "seat");
|
this.setTeleportState(mode, "", "seat");
|
||||||
}
|
}
|
||||||
|
@ -304,7 +276,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
return makeRunningValues(true, [], []);
|
return makeRunningValues(true, [], []);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target === TARGET.NONE || target === TARGET.INVALID || this.state === TELEPORTER_STATES.COOL_IN) {
|
if (target === TARGET.NONE || target === TARGET.INVALID) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
} else if (target === TARGET.SEAT) {
|
} else if (target === TARGET.SEAT) {
|
||||||
Entities.callEntityMethod(result.objectID, 'sit');
|
Entities.callEntityMethod(result.objectID, 'sit');
|
||||||
|
|
Loading…
Reference in a new issue