Skip to main content

worldScaling

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

Availability​

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

Type Signature​

"automatic" | "dynamic"

Examples​

Using initScene​

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

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

Using the Web App Manifest​

Manifest key naming

In a Web App Manifest, convert camelCase keys such as worldScaling to lowercase snake_case such as world_scaling.

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

Default Value​

"automatic"

Accepted Values​

ValueMeaning
"automatic"Shows a distance-based scaling effect during movement, like a real-world object.
"dynamic"Keeps a constant size relative to the user's field of view during movement, just like the default behavior of a window Spatial Scene.