Skip to main content

Editor.Assets.Physics.WorldSettingsAsset

Class

Asset configuring global physics simulation settings.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const assetManager = model.project.assetManager;
const worldSettingsList = assetManager.assets.filter(
a => a.getTypeName() === Editor.Assets.Physics.WorldSettingsAsset.getTypeName()
) as Editor.Assets.Physics.WorldSettingsAsset[];
if (worldSettingsList.length === 0) {
console.log('No WorldSettingsAsset found');
return;
}
const settings = worldSettingsList[0];

// Inspect core simulation properties: gravity, absoluteSpeedLimit, simulationRate
// Check layer collision pair (layers 0 and 1)
const canCollide = settings.getLayersCollidable(0, 1);
const dm = settings.defaultMatter;
const friction = Editor.isNull(dm) ? 'n/a' : dm.friction;

console.log(`WorldSettingsAsset "${settings.name}": gravity=${settings.gravity}, layers 0+1 collidable=${canCollide}, defaultMatter.friction=${friction}`);

Extends

Properties

absoluteSpeedLimit

absoluteSpeedLimit: number

Maximum velocity magnitude any rigid body can reach.


cacheFile

readonly cacheFile: Path

Path to the cached asset file.

Inherited from

WorldSettingsBase.cacheFile


defaultFilter

defaultFilter: Filter

Default collision filter applied to new physics objects.


defaultMatter

defaultMatter: Matter

Default material properties for new physics objects.


fileMeta

readonly fileMeta: AssetImportMetadata

Import metadata for the asset.

Inherited from

WorldSettingsBase.fileMeta


gravity

gravity: vec3

Gravitational acceleration vector applied to the world.


id

readonly id: Uuid

The unique id of the entity.

Inherited from

WorldSettingsBase.id


meta

readonly meta: Meta

Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

Inherited from

WorldSettingsBase.meta


name

readonly name: string

The name of the asset.

Inherited from

WorldSettingsBase.name


relativeSpeedLimit

relativeSpeedLimit: number

Speed limit relative to an object's mass.


simulationRate

simulationRate: number

Timestep frequency for physics calculations per second.


slowDownStep

slowDownStep: number

Time reduction per simulation step when slowdown is active.


slowDownTime

slowDownTime: number

Duration to apply physics slowdown when triggered.


type

readonly type: string

The entity's type.

Inherited from

WorldSettingsBase.type

Methods

getDirectlyReferencedEntities()

getDirectlyReferencedEntities(): Entity[]

A list of entities which this entity has a reference to.

Returns

Entity[]

Inherited from

WorldSettingsBase.getDirectlyReferencedEntities


getLayersCollidable()

getLayersCollidable(layerNumberA, layerNumberB): boolean

Return whether two physics layers can collide.

Parameters

ParameterType
layerNumberAnumber
layerNumberBnumber

Returns

boolean


getMeta()

static getMeta(): Meta

Returns metadata about this type.

Returns

Meta

Overrides

WorldSettingsBase.getMeta


getOwnedEntities()

getOwnedEntities(): Entity[]

A list of entities which has a reference to this entity.

Returns

Entity[]

Inherited from

WorldSettingsBase.getOwnedEntities


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

WorldSettingsBase.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

WorldSettingsBase.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

WorldSettingsBase.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

WorldSettingsBase.isSame