(px, pz, elapsed)
| 244 | // Occasional twitch/attempt to move, asymmetric breathing |
| 245 | |
| 246 | poseFallen(px, pz, elapsed) { |
| 247 | // Irregular twitch -- sharper, less periodic |
| 248 | const twitchArm = Math.sin(elapsed * 0.3) * 0.003 + |
| 249 | Math.sin(elapsed * 1.7) * 0.008 * Math.max(0, Math.sin(elapsed * 0.15)); |
| 250 | const twitchLeg = Math.cos(elapsed * 0.4) * 0.005 * |
| 251 | Math.max(0, Math.sin(elapsed * 0.2 + 1.0)); |
| 252 | |
| 253 | // Asymmetric breathing (one side of chest rises more) |
| 254 | const breathL = Math.sin(elapsed * 0.8) * 0.006; |
| 255 | const breathR = Math.sin(elapsed * 0.8 + 0.3) * 0.004; |
| 256 | |
| 257 | // Attempt to move (slow reach every ~10s) |
| 258 | const attemptCycle = elapsed % 10.0; |
| 259 | const attempting = attemptCycle > 8.0 && attemptCycle < 9.5; |
| 260 | const attemptAmt = attempting ? Math.sin((attemptCycle - 8.0) * Math.PI / 1.5) * 0.05 : 0; |
| 261 | |
| 262 | return [ |
| 263 | [px + 0.35, 0.12, pz + 0.15 + twitchArm], // 0 nose |
| 264 | [px + 0.33, 0.14, pz + 0.13], // 1 left eye |
| 265 | [px + 0.37, 0.14, pz + 0.17], // 2 right eye |
| 266 | [px + 0.38, 0.11, pz + 0.1], // 3 left ear |
| 267 | [px + 0.38, 0.11, pz + 0.2], // 4 right ear |
| 268 | [px + 0.15, 0.15 + breathL, pz - 0.1], // 5 left shoulder |
| 269 | [px + 0.15, 0.2 + breathR, pz + 0.25], // 6 right shoulder |
| 270 | [px - 0.05, 0.08, pz - 0.25 + twitchArm], // 7 left elbow |
| 271 | [px + 0.3, 0.22 + attemptAmt * 0.5, pz + 0.45 + attemptAmt], // 8 right elbow (reaching) |
| 272 | [px - 0.15, 0.05, pz - 0.3 + twitchArm * 1.5], // 9 left wrist |
| 273 | [px + 0.4, 0.15 + attemptAmt, pz + 0.5 + attemptAmt * 1.5], // 10 right wrist (reaching) |
| 274 | [px - 0.05, 0.12, pz - 0.05], // 11 left hip |
| 275 | [px - 0.05, 0.12, pz + 0.15], // 12 right hip |
| 276 | [px - 0.2, 0.08 + twitchLeg, pz - 0.3], // 13 left knee |
| 277 | [px - 0.15, 0.15, pz + 0.35 + twitchLeg], // 14 right knee |
| 278 | [px - 0.35, 0.04, pz - 0.2], // 15 left ankle |
| 279 | [px - 0.3, 0.04, pz + 0.5], // 16 right ankle |
| 280 | ]; |
| 281 | } |
| 282 | |
| 283 | // ---- Falling ----------------------------------------------------------- |
| 284 | // Flailing arms, head snap, non-linear easing (cubic ease-in) |
no outgoing calls
no test coverage detected