Showing the changes to scripts/system/controllers/controllerModules (1 of 1 file). Show all
Unified · Split
| @@ -22,7 +22,6 @@ Script.include("/~/system/libraries/controllers.js"); · 21 unmodified lines | |||
| 22 | (function() { // BEGIN LOCAL_SCOPE | 22 | (function() { // BEGIN LOCAL_SCOPE |
| 23 | 23 | ||
| 24 | var TARGET_MODEL_URL = Script.resolvePath("../../assets/models/teleport-destination.fbx"); | 24 | var TARGET_MODEL_URL = Script.resolvePath("../../assets/models/teleport-destination.fbx"); |
| 25 | var TOO_CLOSE_MODEL_URL = Script.resolvePath("../../assets/models/teleport-cancel.fbx"); | ||
| 26 | var SEAT_MODEL_URL = Script.resolvePath("../../assets/models/teleport-seat.fbx"); | 25 | var SEAT_MODEL_URL = Script.resolvePath("../../assets/models/teleport-seat.fbx"); |
| 27 | 26 | ||
| 28 | var TARGET_MODEL_DIMENSIONS = { | 27 | var TARGET_MODEL_DIMENSIONS = { |
| @@ -49,8 +48,6 @@ Script.include("/~/system/libraries/controllers.js"); · 20 unmodified lines | |||
| 49 | blue: 73 | 48 | blue: 73 |
| 50 | }; | 49 | }; |
| 51 | 50 | ||
| 52 | var COOL_IN_DURATION = 300; | ||
| 53 | |||
| 54 | var handInfo = { | 51 | var handInfo = { |
| 55 | right: { | 52 | right: { |
| 56 | controllerInput: Controller.Standard.RightHand | 53 | controllerInput: Controller.Standard.RightHand |
| @@ -61,37 +58,19 @@ Script.include("/~/system/libraries/controllers.js"); · 4 unmodified lines | |||
| 61 | }; | 58 | }; |
| 62 | 59 | ||
| 63 | var cancelPath = { | 60 | var cancelPath = { |
| 64 | type: "line3d", | ||
| 65 | color: COLORS_TELEPORT_CANCEL, | 61 | color: COLORS_TELEPORT_CANCEL, |
| 66 | ignorePickIntersection: true, | ||
| 67 | alpha: 1, | 62 | alpha: 1, |
| 68 | solid: true, | 63 | width: 0.025 |
| 69 | drawInFront: true, | ||
| 70 | glow: 1.0 | ||
| 71 | }; | 64 | }; |
| 72 | var teleportPath = { | 65 | var teleportPath = { |
| 73 | type: "line3d", | ||
| 74 | color: COLORS_TELEPORT_CAN_TELEPORT, | 66 | color: COLORS_TELEPORT_CAN_TELEPORT, |
| 75 | ignorePickIntersection: true, | ||
| 76 | alpha: 1, | 67 | alpha: 1, |
| 77 | solid: true, | 68 | width: 0.025 |
| 78 | drawInFront: true, | ||
| 79 | glow: 1.0 | ||
| 80 | }; | 69 | }; |
| 81 | var seatPath = { | 70 | var seatPath = { |
| 82 | type: "line3d", | ||
| 83 | color: COLORS_TELEPORT_SEAT, | 71 | color: COLORS_TELEPORT_SEAT, |
| 84 | ignorePickIntersection: true, | ||
| 85 | alpha: 1, | 72 | alpha: 1, |
| 86 | solid: true, | 73 | width: 0.025 |
| 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 | ||
| 95 | }; | 74 | }; |
| 96 | var teleportEnd = { | 75 | var teleportEnd = { |
| 97 | type: "model", | 76 | type: "model", |
| @@ -107,20 +86,18 @@ Script.include("/~/system/libraries/controllers.js"); · 9 unmodified lines | |||
| 107 | }; | 86 | }; |
| 108 | 87 | ||
| 109 | 88 | ||
| 110 | var teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd}, | 89 | var teleportRenderStates = [{name: "cancel", path: cancelPath}, |
| 111 | {name: "teleport", path: teleportPath, end: teleportEnd}, | 90 | {name: "teleport", path: teleportPath, end: teleportEnd}, |
| 112 | {name: "seat", path: seatPath, end: seatEnd}]; | 91 | {name: "seat", path: seatPath, end: seatEnd}]; |
| 113 | 92 | ||
| 114 | var DEFAULT_DISTANCE = 50; | 93 | var DEFAULT_DISTANCE = 8.0; |
| 115 | var teleportDefaultRenderStates = [{name: "cancel", distance: DEFAULT_DISTANCE, path: cancelPath}]; | 94 | var teleportDefaultRenderStates = [{name: "cancel", distance: DEFAULT_DISTANCE, path: cancelPath}]; |
| 116 | 95 | ||
| 117 | var coolInTimeout = null; | ||
| 118 | var ignoredEntities = []; | 96 | var ignoredEntities = []; |
| 119 | 97 | ||
| 120 | 98 | ||
| 121 | var TELEPORTER_STATES = { | 99 | var TELEPORTER_STATES = { |
| 122 | IDLE: 'idle', | 100 | IDLE: 'idle', |
| 123 | COOL_IN: 'cool_in', | ||
| 124 | TARGETTING: 'targetting', | 101 | TARGETTING: 'targetting', |
| 125 | TARGETTING_INVALID: 'targetting_invalid' | 102 | TARGETTING_INVALID: 'targetting_invalid' |
| 126 | }; | 103 | }; |
| @@ -133,7 +110,7 @@ Script.include("/~/system/libraries/controllers.js"); · 6 unmodified lines | |||
| 133 | SEAT: 'seat' // The current target is a seat | 110 | SEAT: 'seat' // The current target is a seat |
| 134 | }; | 111 | }; |
| 135 | 112 | ||
| 136 | var speed = 7.0; | 113 | var speed = 12.0; |
| 137 | var accelerationAxis = {x: 0.0, y: -5.0, z: 0.0}; | 114 | var accelerationAxis = {x: 0.0, y: -5.0, z: 0.0}; |
| 138 | 115 | ||
| 139 | function Teleporter(hand) { | 116 | function Teleporter(hand) { |
| @@ -151,8 +128,10 @@ Script.include("/~/system/libraries/controllers.js"); · 11 unmodified lines | |||
| 151 | return otherModule; | 128 | return otherModule; |
| 152 | }; | 129 | }; |
| 153 | 130 | ||
| 154 | this.teleportParabolaHandVisible = Pointers.createPointer(PickType.Ray, { | 131 | this.teleportParabolaHandVisible = Pointers.createPointer(PickType.Parabola, { |
| 155 | joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND", | 132 | 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 }, | ||
| 156 | filter: Picks.PICK_ENTITIES, | 135 | filter: Picks.PICK_ENTITIES, |
| 157 | faceAvatar: true, | 136 | faceAvatar: true, |
| 158 | scaleWithAvatar: true, | 137 | scaleWithAvatar: true, |
| @@ -161,10 +140,13 @@ Script.include("/~/system/libraries/controllers.js"); · 2 unmodified lines | |||
| 161 | accelerationAxis: accelerationAxis, | 140 | accelerationAxis: accelerationAxis, |
| 162 | rotateAccelerationWithAvatar: true, | 141 | rotateAccelerationWithAvatar: true, |
| 163 | renderStates: teleportRenderStates, | 142 | renderStates: teleportRenderStates, |
| 164 | defaultRenderStates: teleportDefaultRenderStates | 143 | defaultRenderStates: teleportDefaultRenderStates, |
| 144 | maxDistance: 8.0 | ||
| 165 | }); | 145 | }); |
| 166 | this.teleportParabolaHandInvisible = Pointers.createPointer(PickType.Ray, { | 146 | this.teleportParabolaHandInvisible = Pointers.createPointer(PickType.Parabola, { |
| 167 | joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND", | 147 | 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 }, | ||
| 168 | filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, | 150 | filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, |
| 169 | faceAvatar: true, | 151 | faceAvatar: true, |
| 170 | scaleWithAvatar: true, | 152 | scaleWithAvatar: true, |
| @@ -172,9 +154,10 @@ Script.include("/~/system/libraries/controllers.js"); · 1 unmodified line | |||
| 172 | speed: speed, | 154 | speed: speed, |
| 173 | accelerationAxis: accelerationAxis, | 155 | accelerationAxis: accelerationAxis, |
| 174 | rotateAccelerationWithAvatar: true, | 156 | rotateAccelerationWithAvatar: true, |
| 175 | renderStates: teleportRenderStates | 157 | renderStates: teleportRenderStates, |
| 158 | maxDistance: 8.0 | ||
| 176 | }); | 159 | }); |
| 177 | this.teleportParabolaHeadVisible = Pointers.createPointer(PickType.Ray, { | 160 | this.teleportParabolaHeadVisible = Pointers.createPointer(PickType.Parabola, { |
| 178 | joint: "Avatar", | 161 | joint: "Avatar", |
| 179 | filter: Picks.PICK_ENTITIES, | 162 | filter: Picks.PICK_ENTITIES, |
| 180 | faceAvatar: true, | 163 | faceAvatar: true, |
| @@ -184,9 +167,10 @@ Script.include("/~/system/libraries/controllers.js"); · 3 unmodified lines | |||
| 184 | accelerationAxis: accelerationAxis, | 167 | accelerationAxis: accelerationAxis, |
| 185 | rotateAccelerationWithAvatar: true, | 168 | rotateAccelerationWithAvatar: true, |
| 186 | renderStates: teleportRenderStates, | 169 | renderStates: teleportRenderStates, |
| 187 | defaultRenderStates: teleportDefaultRenderStates | 170 | defaultRenderStates: teleportDefaultRenderStates, |
| 171 | maxDistance: 8.0 | ||
| 188 | }); | 172 | }); |
| 189 | this.teleportParabolaHeadInvisible = Pointers.createPointer(PickType.Ray, { | 173 | this.teleportParabolaHeadInvisible = Pointers.createPointer(PickType.Parabola, { |
| 190 | joint: "Avatar", | 174 | joint: "Avatar", |
| 191 | filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, | 175 | filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, |
| 192 | faceAvatar: true, | 176 | faceAvatar: true, |
| @@ -195,7 +179,8 @@ Script.include("/~/system/libraries/controllers.js"); · 2 unmodified lines | |||
| 195 | speed: speed, | 179 | speed: speed, |
| 196 | accelerationAxis: accelerationAxis, | 180 | accelerationAxis: accelerationAxis, |
| 197 | rotateAccelerationWithAvatar: true, | 181 | rotateAccelerationWithAvatar: true, |
| 198 | renderStates: teleportRenderStates | 182 | renderStates: teleportRenderStates, |
| 183 | maxDistance: 8.0 | ||
| 199 | }); | 184 | }); |
| 200 | 185 | ||
| 201 | this.cleanup = function() { | 186 | this.cleanup = function() { |
| @@ -216,16 +201,7 @@ Script.include("/~/system/libraries/controllers.js"); · 14 unmodified lines | |||
| 216 | 100); | 201 | 100); |
| 217 | 202 | ||
| 218 | this.enterTeleport = function() { | 203 | this.enterTeleport = function() { |
| 219 | if (coolInTimeout !== null) { | 204 | this.state = TELEPORTER_STATES.TARGETTING; |
| 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); | ||
| 229 | }; | 205 | }; |
| 230 | 206 | ||
| 231 | this.isReady = function(controllerData, deltaTime) { | 207 | this.isReady = function(controllerData, deltaTime) { |
| @@ -287,11 +263,7 @@ Script.include("/~/system/libraries/controllers.js"); · 55 unmodified lines | |||
| 287 | } else if (teleportLocationType === TARGET.INVALID || teleportLocationType === TARGET.INVISIBLE) { | 263 | } else if (teleportLocationType === TARGET.INVALID || teleportLocationType === TARGET.INVISIBLE) { |
| 288 | this.setTeleportState(mode, "", "cancel"); | 264 | this.setTeleportState(mode, "", "cancel"); |
| 289 | } else if (teleportLocationType === TARGET.SURFACE) { | 265 | } else if (teleportLocationType === TARGET.SURFACE) { |
| 290 | if (this.state === TELEPORTER_STATES.COOL_IN) { | 266 | this.setTeleportState(mode, "teleport", ""); |
| 291 | this.setTeleportState(mode, "cancel", ""); | ||
| 292 | } else { | ||
| 293 | this.setTeleportState(mode, "teleport", ""); | ||
| 294 | } | ||
| 295 | } else if (teleportLocationType === TARGET.SEAT) { | 267 | } else if (teleportLocationType === TARGET.SEAT) { |
| 296 | this.setTeleportState(mode, "", "seat"); | 268 | this.setTeleportState(mode, "", "seat"); |
| 297 | } | 269 | } |
| @@ -304,7 +276,7 @@ Script.include("/~/system/libraries/controllers.js"); · 6 unmodified lines | |||
| 304 | return makeRunningValues(true, [], []); | 276 | return makeRunningValues(true, [], []); |
| 305 | } | 277 | } |
| 306 | 278 | ||
| 307 | if (target === TARGET.NONE || target === TARGET.INVALID || this.state === TELEPORTER_STATES.COOL_IN) { | 279 | if (target === TARGET.NONE || target === TARGET.INVALID) { |
| 308 | // Do nothing | 280 | // Do nothing |
| 309 | } else if (target === TARGET.SEAT) { | 281 | } else if (target === TARGET.SEAT) { |
| 310 | Entities.callEntityMethod(result.objectID, 'sit'); | 282 | Entities.callEntityMethod(result.objectID, 'sit'); |