VR PROJECTS / FOLLOW THE COACH / STUDY 01
How time selects a pose
Start with one part of the system: time → pose number → pose data → drawing. This exercise imports a snapshot of the game's pose table and timing function.
QuestTracks headset and controllers
→
WebXRExposes their poses to the page
→
Game logicSelects poses, targets, and results
→
OutputUpdates visuals, sound, and partner view
Selected pose
Pose 1 / 8 a: left side of this front view b: right side of this front view
This drawing isolates pose selection. The VR scene also places each target in 3D relative to the player.
Control time
Paused- Beat length
- 0.60 s
- Pose number k
- 0
- Table index
- 0
- Time per pose
- 1.20 s
Change the formula
Local experiment onlyThis is the function that selects a pose number. Change 2 * beat to 4 * beat, run it, and move the time slider. Each pose should remain selected longer. Your edit does not change the VR game.
Using the original game formula.
Game code snapshots: Pose table and timing · VR scene
Three things to understand
beatis the length of one beat in seconds. Dance uses 0.6 seconds.k = Math.floor(time / (2 * beat))advances the pose every two beats.Math.floorrounds down to an integer.- The table contains eight poses.
k % 8loops back to table index 0 after index 7.
Try this: set Dance mode to 2.5 seconds. Predict k and the table index before checking the numbers.
The exercise starts at time 0 to make the calculation visible. The game uses a shared clock, so k is usually much larger; the modulo loop is the same.