Editor.Shape
ClassRepresents a 2D or 3D shape object.
Index
Methods
Example
// Editor.Shape is a factory for physics shapes (Box, Sphere, Capsule, …).
// Use it to produce an Editor.Components.Physics.Shape and assign that
// to a ColliderComponent's `shape` property to give the collider a
// geometry for physics simulation.
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;
// Create a scene object with a physics Collider.
const obj = scene.createSceneObject('PhysicsBox');
const collider = obj.addComponent('ColliderComponent') as Editor.Components.Physics.ColliderComponent;
// Produce a physics Box shape and attach it to the collider.
const box = Editor.Shape.createBoxShape(scene);
collider.shape = box;
console.log(`Collider on ${obj.name} uses shape ${box.getTypeName()}`);
// Available factory methods: createBoxShape, createSphereShape,
// createCapsuleShape, createConeShape, createCylinderShape,
// createLevelSetShape, createMeshShape.
Methods
createBoxShape()
staticcreateBoxShape(scene):Box
Creates a box-shaped physics collision component and adds it to the given scene.
Parameters
| Parameter | Type |
|---|---|
scene | Scene |
Returns
createCapsuleShape()
staticcreateCapsuleShape(scene):Capsule
Creates a capsule-shaped physics collision component and adds it to the given scene.
Parameters
| Parameter | Type |
|---|---|
scene | Scene |
Returns
createConeShape()
staticcreateConeShape(scene):Cone
Creates a cone-shaped physics collision component and adds it to the given scene.
Parameters
| Parameter | Type |
|---|---|
scene | Scene |
Returns
createCylinderShape()
staticcreateCylinderShape(scene):Cylinder
Creates a cylinder-shaped physics collision component and adds it to the given scene.
Parameters
| Parameter | Type |
|---|---|
scene | Scene |
Returns
createLevelSetShape()
staticcreateLevelSetShape(scene):LevelSet
Creates a level set physics collision component and adds it to the given scene.
Parameters
| Parameter | Type |
|---|---|
scene | Scene |
Returns
createMeshShape()
staticcreateMeshShape(scene):Mesh
Creates a mesh-based physics collision component and adds it to the given scene.
Parameters
| Parameter | Type |
|---|---|
scene | Scene |
Returns
createSphereShape()
staticcreateSphereShape(scene):Sphere
Creates a sphere-shaped physics collision component and adds it to the given scene.
Parameters
| Parameter | Type |
|---|---|
scene | Scene |