Skip to main content

Editor.Components.Physics

Class

Namespace containing physics simulation components, shapes, and constraints for rigid bodies and colliders.

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;
const assetManager = model.project.assetManager;

const worldSettings = assetManager.createNativeAsset(
'WorldSettingsAsset', 'MyWorldSettings',
new Editor.Model.SourcePath(new Editor.Path(''), Editor.Model.SourceRootDirectory.Assets)
) as Editor.Assets.Physics.WorldSettingsAsset;
worldSettings.gravity = new vec3(0, -9.81, 0);

const worldObj = scene.createSceneObject('PhysicsWorld');
const worldComp = worldObj.addComponent('WorldComponent') as Editor.Components.Physics.WorldComponent;
worldComp.worldSettings = worldSettings;

const bodyObj = scene.createSceneObject('PhysicsBody');
const body = bodyObj.addComponent('BodyComponent') as Editor.Components.Physics.BodyComponent;
body.dynamic = true;

console.log(`WorldSettings gravity: ${worldSettings.gravity}, body dynamic: ${body.dynamic}`);

Nested types

Enumerations

EnumerationDescription
BodySettingEnum specifying how a physics body's mass is calculated.
ConstraintPhysics constraint types for rigidbody connections.

Classes

ClassDescription
BodyComponentRigid body physics component for dynamic objects.
BoxBox-shaped physics collider component.
CapsuleA capsule-shaped physics collider.
ColliderComponentDefines collision geometry and physics properties for an object.
ConeCone-shaped physics collider.
ConstraintComponentComponent that applies physics constraints to a scene object.
CylinderCylindrical physics shape with configurable axis, length, and radius.
LevelSetA physics shape using a level set asset for complex collision geometry.
MeshPhysics mesh shape component for collision detection using custom meshes.
ShapeBase class for physics shapes attached to entities.
SphereA spherical physics shape component.
WorldComponentPhysics world container managing simulation and settings.