Skip to content

Variable: PhysicsShapeType

const PhysicsShapeType: object

Defined in: packages/core/src/physics/physicsShape.ts:11

Available physics shape types for PhysicsShape.

Type Declaration

Auto

readonly Auto: "Auto" = 'Auto'

Automatically detects the best shape from the entity's Three.js geometry. The shape type mapping is SphereGeometry -> PhysicsShapeType.Sphere, BoxGeometry | PlaneGeometry -> PhysicsShapeType.Box, CylinderGeometry -> PhysicsShapeType.Cylinder, default -> PhysicsShapeType.ConvexHull, When this type is selected, the dimensions field in PhysicsShape will be overridden by the size of the Three.js geometry.

Box

readonly Box: "Box" = 'Box'

A box shape is described by the dimensions as [width, height, depth]. Good for rectangular objects.

Capsules

readonly Capsules: "Capsules" = 'Capsules'

Capsules are similar to cylinders, but have two half-spheres on each end. A Capsules shape is defined by the radius in dimensions[0] and height in dimensions[1].

ConvexHull

readonly ConvexHull: "ConvexHull" = 'ConvexHull'

A convex is a shape that, if two points are part of the shape, then the segment between these two points is also part of the shape. The physics engine would creates a convex wrapper around the mesh. This is a great approximation for most objects since it's more accurate than primitives and much more efficient than TriMesh.

Cylinder

readonly Cylinder: "Cylinder" = 'Cylinder'

A cylinder shape is defined by the radius in dimensions[0] and height in dimensions[1].

Sphere

readonly Sphere: "Sphere" = 'Sphere'

The sphere is described by just the radius in dimensions[0]. Efficient for round objects.

TriMesh

readonly TriMesh: "TriMesh" = 'TriMesh'

Uses exact mesh geometry in the physics engine. This will give the closest match to your render geometry but may cause expensive compute load when two complex mesh shapes collide with each other. Typically used for static objects.