OrientationSensor: populateMatrix() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
ThepopulateMatrix() method of theOrientationSensor interface populates the given target matrix with therotation matrix based on the latest sensor reading. The rotation matrix is shownbelow.

where:
- W = cos(θ/2)
- X = Vx * sin(θ/2)
- Y = Vy * sin(θ/2)
- Z = Vz * sin(θ/2)
In this article
Syntax
js
populateMatrix(targetMatrix)BecauseOrientationSensor is a base class,populateMatrixmay only be read from one of its derived classes.
Parameters
targetMatrixTBD
Return value
None (undefined).
Examples
js
// TBDSpecifications
| Specification |
|---|
| Orientation Sensor> # orientationsensor-populatematrix> |