History

mukul's changes, enable parabolic teleport

SamGondelman committed 8 years ago

Commit e11030b1 parent 3d4639b1 file · +25 −53Browse files

Showing the changes to scripts/system/controllers/controllerModules (1 of 1 file). Show all

Unified · Split

scripts/system/controllers/controllerModules/teleport.js+25−53
@@ -22,7 +22,6 @@ Script.include("/~/system/libraries/controllers.js"); · 21 unmodified lines
2222 (function() { // BEGIN LOCAL_SCOPE
2323
2424 var TARGET_MODEL_URL = Script.resolvePath("../../assets/models/teleport-destination.fbx");
25− var TOO_CLOSE_MODEL_URL = Script.resolvePath("../../assets/models/teleport-cancel.fbx");
2625 var SEAT_MODEL_URL = Script.resolvePath("../../assets/models/teleport-seat.fbx");
2726
2827 var TARGET_MODEL_DIMENSIONS = {
@@ -49,8 +48,6 @@ Script.include("/~/system/libraries/controllers.js"); · 20 unmodified lines
4948 blue: 73
5049 };
5150
52− var COOL_IN_DURATION = 300;
53−
5451 var handInfo = {
5552 right: {
5653 controllerInput: Controller.Standard.RightHand
@@ -61,37 +58,19 @@ Script.include("/~/system/libraries/controllers.js"); · 4 unmodified lines
6158 };
6259
6360 var cancelPath = {
64− type: "line3d",
6561 color: COLORS_TELEPORT_CANCEL,
66− ignorePickIntersection: true,
6762 alpha: 1,
68− solid: true,
69− drawInFront: true,
70− glow: 1.0
63+ width: 0.025
7164 };
7265 var teleportPath = {
73− type: "line3d",
7466 color: COLORS_TELEPORT_CAN_TELEPORT,
75− ignorePickIntersection: true,
7667 alpha: 1,
77− solid: true,
78− drawInFront: true,
79− glow: 1.0
68+ width: 0.025
8069 };
8170 var seatPath = {
82− type: "line3d",
8371 color: COLORS_TELEPORT_SEAT,
84− ignorePickIntersection: true,
8572 alpha: 1,
86− solid: true,
87− drawInFront: true,
88− glow: 1.0
89− };
90− var cancelEnd = {
91− type: "model",
92− url: TOO_CLOSE_MODEL_URL,
93− dimensions: TARGET_MODEL_DIMENSIONS,
94− ignorePickIntersection: true
73+ width: 0.025
9574 };
9675 var teleportEnd = {
9776 type: "model",
@@ -107,20 +86,18 @@ Script.include("/~/system/libraries/controllers.js"); · 9 unmodified lines
10786 };
10887
10988
110− var teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd},
89+ var teleportRenderStates = [{name: "cancel", path: cancelPath},
11190 {name: "teleport", path: teleportPath, end: teleportEnd},
11291 {name: "seat", path: seatPath, end: seatEnd}];
11392
114− var DEFAULT_DISTANCE = 50;
93+ var DEFAULT_DISTANCE = 8.0;
11594 var teleportDefaultRenderStates = [{name: "cancel", distance: DEFAULT_DISTANCE, path: cancelPath}];
11695
117− var coolInTimeout = null;
11896 var ignoredEntities = [];
11997
12098
12199 var TELEPORTER_STATES = {
122100 IDLE: 'idle',
123− COOL_IN: 'cool_in',
124101 TARGETTING: 'targetting',
125102 TARGETTING_INVALID: 'targetting_invalid'
126103 };
@@ -133,7 +110,7 @@ Script.include("/~/system/libraries/controllers.js"); · 6 unmodified lines
133110 SEAT: 'seat' // The current target is a seat
134111 };
135112
136− var speed = 7.0;
113+ var speed = 12.0;
137114 var accelerationAxis = {x: 0.0, y: -5.0, z: 0.0};
138115
139116 function Teleporter(hand) {
@@ -151,8 +128,10 @@ Script.include("/~/system/libraries/controllers.js"); · 11 unmodified lines
151128 return otherModule;
152129 };
153130
154− this.teleportParabolaHandVisible = Pointers.createPointer(PickType.Ray, {
131+ this.teleportParabolaHandVisible = Pointers.createPointer(PickType.Parabola, {
155132 joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
133+ dirOffset: { x: 0, y: 1, z: 0.1 },
134+ posOffset: { x: (_this.hand === RIGHT_HAND) ? 0.03 : -0.03, y: 0.2, z: 0.02 },
156135 filter: Picks.PICK_ENTITIES,
157136 faceAvatar: true,
158137 scaleWithAvatar: true,
@@ -161,10 +140,13 @@ Script.include("/~/system/libraries/controllers.js"); · 2 unmodified lines
161140 accelerationAxis: accelerationAxis,
162141 rotateAccelerationWithAvatar: true,
163142 renderStates: teleportRenderStates,
164− defaultRenderStates: teleportDefaultRenderStates
143+ defaultRenderStates: teleportDefaultRenderStates,
144+ maxDistance: 8.0
165145 });
166− this.teleportParabolaHandInvisible = Pointers.createPointer(PickType.Ray, {
146+ this.teleportParabolaHandInvisible = Pointers.createPointer(PickType.Parabola, {
167147 joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
148+ dirOffset: { x: 0, y: 1, z: 0.1 },
149+ posOffset: { x: (_this.hand === RIGHT_HAND) ? 0.03 : -0.03, y: 0.2, z: 0.02 },
168150 filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
169151 faceAvatar: true,
170152 scaleWithAvatar: true,
@@ -172,9 +154,10 @@ Script.include("/~/system/libraries/controllers.js"); · 1 unmodified line
172154 speed: speed,
173155 accelerationAxis: accelerationAxis,
174156 rotateAccelerationWithAvatar: true,
175− renderStates: teleportRenderStates
157+ renderStates: teleportRenderStates,
158+ maxDistance: 8.0
176159 });
177− this.teleportParabolaHeadVisible = Pointers.createPointer(PickType.Ray, {
160+ this.teleportParabolaHeadVisible = Pointers.createPointer(PickType.Parabola, {
178161 joint: "Avatar",
179162 filter: Picks.PICK_ENTITIES,
180163 faceAvatar: true,
@@ -184,9 +167,10 @@ Script.include("/~/system/libraries/controllers.js"); · 3 unmodified lines
184167 accelerationAxis: accelerationAxis,
185168 rotateAccelerationWithAvatar: true,
186169 renderStates: teleportRenderStates,
187− defaultRenderStates: teleportDefaultRenderStates
170+ defaultRenderStates: teleportDefaultRenderStates,
171+ maxDistance: 8.0
188172 });
189− this.teleportParabolaHeadInvisible = Pointers.createPointer(PickType.Ray, {
173+ this.teleportParabolaHeadInvisible = Pointers.createPointer(PickType.Parabola, {
190174 joint: "Avatar",
191175 filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
192176 faceAvatar: true,
@@ -195,7 +179,8 @@ Script.include("/~/system/libraries/controllers.js"); · 2 unmodified lines
195179 speed: speed,
196180 accelerationAxis: accelerationAxis,
197181 rotateAccelerationWithAvatar: true,
198− renderStates: teleportRenderStates
182+ renderStates: teleportRenderStates,
183+ maxDistance: 8.0
199184 });
200185
201186 this.cleanup = function() {
@@ -216,16 +201,7 @@ Script.include("/~/system/libraries/controllers.js"); · 14 unmodified lines
216201 100);
217202
218203 this.enterTeleport = function() {
219− if (coolInTimeout !== null) {
220− Script.clearTimeout(coolInTimeout);
221− }
222−
223− this.state = TELEPORTER_STATES.COOL_IN;
224− coolInTimeout = Script.setTimeout(function() {
225− if (_this.state === TELEPORTER_STATES.COOL_IN) {
226− _this.state = TELEPORTER_STATES.TARGETTING;
227− }
228− }, COOL_IN_DURATION);
204+ this.state = TELEPORTER_STATES.TARGETTING;
229205 };
230206
231207 this.isReady = function(controllerData, deltaTime) {
@@ -287,11 +263,7 @@ Script.include("/~/system/libraries/controllers.js"); · 55 unmodified lines
287263 } else if (teleportLocationType === TARGET.INVALID || teleportLocationType === TARGET.INVISIBLE) {
288264 this.setTeleportState(mode, "", "cancel");
289265 } else if (teleportLocationType === TARGET.SURFACE) {
290− if (this.state === TELEPORTER_STATES.COOL_IN) {
291− this.setTeleportState(mode, "cancel", "");
292− } else {
293− this.setTeleportState(mode, "teleport", "");
294− }
266+ this.setTeleportState(mode, "teleport", "");
295267 } else if (teleportLocationType === TARGET.SEAT) {
296268 this.setTeleportState(mode, "", "seat");
297269 }
@@ -304,7 +276,7 @@ Script.include("/~/system/libraries/controllers.js"); · 6 unmodified lines
304276 return makeRunningValues(true, [], []);
305277 }
306278
307− if (target === TARGET.NONE || target === TARGET.INVALID || this.state === TELEPORTER_STATES.COOL_IN) {
279+ if (target === TARGET.NONE || target === TARGET.INVALID) {
308280 // Do nothing
309281 } else if (target === TARGET.SEAT) {
310282 Entities.callEntityMethod(result.objectID, 'sit');