Skip to main content

worldAlignment

One of the initialization properties of a Spatial Scene, worldAlignment affects how a Spatial Scene behaves when the user drags it vertically after creation. Only Spatial Scenes of type volume support worldAlignment.

Availability​

ItemValue
Applies toOnly volume Spatial Scenes.
New scenesSet through initScene.
Start sceneSet through the Web App Manifest.
Default value"automatic"

Type Signature​

"automatic" | "gravityAligned"

Examples​

Using initScene​

Set worldAlignment for a new scene
import { initScene } from "@webspatial/react-sdk";

initScene("newSceneName", defaultConfig => {
return {
...defaultConfig,
type: "volume",
worldAlignment: "gravityAligned",
};
});
window.open(newSceneUrl, "newSceneName");

Using the Web App Manifest​

Manifest key naming

In a Web App Manifest, convert camelCase keys such as worldAlignment to lowercase snake_case such as world_alignment.

Set world_alignment for the start scene
{
"name": "example app",
"start_url": "/",
"xr_main_scene": {
"type": "volume",
"world_alignment": "gravityAligned"
}
}

Default Value​

"automatic"

Accepted Values​

ValueMeaning
"automatic"Tilts automatically during vertical movement so it always faces the user.
"gravityAligned"Does not tilt automatically during vertical movement and always stays aligned with gravity like a real-world object.