History

Change teleport.js to update render state more frequently.

Daniela committed 9 years ago

Commit 13eb7db1 parent 6ad2e281 file · +30 −28Browse files

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

Unified · Split

scripts/system/controllers/controllerModules/teleport.js+30−28
@@ -235,7 +235,35 @@ function Teleporter(hand) { · 234 unmodified lines
235235 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
236236 [],
237237 100);
238−
238+
239+ this.updatePadDimensions = function() {
240+ // pad scale with avatar size
241+ var AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS = Vec3.multiply(MyAvatar.sensorToWorldScale, TARGET_MODEL_DIMENSIONS);
242+
243+ cancelEnd.dimensions = AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS;
244+ teleportEnd.dimensions = AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS;
245+ seatEnd.dimensions = AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS;
246+
247+ teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd},
248+ {name: "teleport", path: teleportPath, end: teleportEnd},
249+ {name: "seat", path: seatPath, end: seatEnd}];
250+
251+ LaserPointers.editRenderState(this.teleportRayHandVisible, "cancel", teleportRenderStates[0]);
252+ LaserPointers.editRenderState(this.teleportRayHandInvisible, "cancel", teleportRenderStates[0]);
253+ LaserPointers.editRenderState(this.teleportRayHeadVisible, "cancel", teleportRenderStates[0]);
254+ LaserPointers.editRenderState(this.teleportRayHeadInvisible, "cancel", teleportRenderStates[0]);
255+
256+ LaserPointers.editRenderState(this.teleportRayHandVisible, "teleport", teleportRenderStates[1]);
257+ LaserPointers.editRenderState(this.teleportRayHandInvisible, "teleport", teleportRenderStates[1]);
258+ LaserPointers.editRenderState(this.teleportRayHeadVisible, "teleport", teleportRenderStates[1]);
259+ LaserPointers.editRenderState(this.teleportRayHeadInvisible, "teleport", teleportRenderStates[1]);
260+
261+ LaserPointers.editRenderState(this.teleportRayHandVisible, "seat", teleportRenderStates[2]);
262+ LaserPointers.editRenderState(this.teleportRayHandInvisible, "seat", teleportRenderStates[2]);
263+ LaserPointers.editRenderState(this.teleportRayHeadVisible, "seat", teleportRenderStates[2]);
264+ LaserPointers.editRenderState(this.teleportRayHeadInvisible, "seat", teleportRenderStates[2]);
265+ }
266+
239267 this.enterTeleport = function() {
240268 if (coolInTimeout !== null) {
241269 Script.clearTimeout(coolInTimeout);
@@ -248,33 +276,7 @@ function Teleporter(hand) { · 6 unmodified lines
248276 }
249277 }, COOL_IN_DURATION);
250278
251− // pad scale with avatar size
252− var AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS = Vec3.multiply(MyAvatar.sensorToWorldScale, TARGET_MODEL_DIMENSIONS);
253−
254− if (!Vec3.equal(AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS, cancelEnd.dimensions)) {
255− cancelEnd.dimensions = AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS;
256− teleportEnd.dimensions = AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS;
257− seatEnd.dimensions = AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS;
258−
259− teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd},
260− {name: "teleport", path: teleportPath, end: teleportEnd},
261− {name: "seat", path: seatPath, end: seatEnd}];
262−
263− LaserPointers.editRenderState(this.teleportRayHandVisible, "cancel", teleportRenderStates[0]);
264− LaserPointers.editRenderState(this.teleportRayHandInvisible, "cancel", teleportRenderStates[0]);
265− LaserPointers.editRenderState(this.teleportRayHeadVisible, "cancel", teleportRenderStates[0]);
266− LaserPointers.editRenderState(this.teleportRayHeadInvisible, "cancel", teleportRenderStates[0]);
267−
268− LaserPointers.editRenderState(this.teleportRayHandVisible, "teleport", teleportRenderStates[1]);
269− LaserPointers.editRenderState(this.teleportRayHandInvisible, "teleport", teleportRenderStates[1]);
270− LaserPointers.editRenderState(this.teleportRayHeadVisible, "teleport", teleportRenderStates[1]);
271− LaserPointers.editRenderState(this.teleportRayHeadInvisible, "teleport", teleportRenderStates[1]);
272−
273− LaserPointers.editRenderState(this.teleportRayHandVisible, "seat", teleportRenderStates[2]);
274− LaserPointers.editRenderState(this.teleportRayHandInvisible, "seat", teleportRenderStates[2]);
275− LaserPointers.editRenderState(this.teleportRayHeadVisible, "seat", teleportRenderStates[2]);
276− LaserPointers.editRenderState(this.teleportRayHeadInvisible, "seat", teleportRenderStates[2]);
277− }
279+ this.updatePadDimensions();
278280 };
279281
280282 this.isReady = function(controllerData, deltaTime) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t