Editor.Assets.Physics.WorldSettingsAsset
ClassAsset configuring global physics simulation settings.
Index
Properties
Methods
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
readonlycacheFile:Path
Path to the cached asset file.
Inherited from
defaultFilter
defaultFilter:
Filter
Default collision filter applied to new physics objects.
defaultMatter
defaultMatter:
Matter
Default material properties for new physics objects.
fileMeta
readonlyfileMeta:AssetImportMetadata
Import metadata for the asset.
Inherited from
gravity
gravity:
vec3
Gravitational acceleration vector applied to the world.
id
readonlyid:Uuid
The unique id of the entity.
Inherited from
meta
readonlymeta:Meta
Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.
Inherited from
name
readonlyname:string
The name of the asset.
Inherited from
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
readonlytype:string
The entity's type.
Inherited from
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
| Parameter | Type |
|---|---|
layerNumberA | number |
layerNumberB | number |
Returns
boolean
getMeta()
staticgetMeta():Meta
Returns metadata about this type.
Returns
Overrides
getOwnedEntities()
getOwnedEntities():
Entity[]
A list of entities which has a reference to this entity.
Returns
Entity[]
Inherited from
WorldSettingsBase.getOwnedEntities
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean