WebXR: Example with rotating object and user movement

In this example, a 3D cube is textured and shaded, spinning in place in the center of the world. The user can then move around the world and adjust the direction in which they're looking.

Click the "Enter WebXR" button to begin the XR session. Use the W, A, S, and D keys to move up and down and to slide left and right, and the and arrow keys to move forward and backward. Press R to reset everything.

← Click here to toggle on and off

Matrices used to generate the scene

Projection matrix

Model view matrix


Camera matrix

Normal matrix


Mouse tracking matrix