Skip to main content

Geometries

Each of the physics bodies covered in the previous section require you to attach some kind of geometry to them which will define their geometry in the physics engine.

Remember that the physics engine only “sees” these geometries, and will detect collision of your physics bodies by checking for overlap between these geometries.

The geometry of your physics body can be a box, a plane, a sphere, a capsule, a cylinder, or a collision geometry.

To add one to your entity, add its corresponding geometry component (i.e. box_geometry, sphere_geometry, etc). To visualize the geometries and make sure their attributes are well set up, enable debug lines.

Box

Compatible with: static body, rigid body, kinematic rigid body, character controller

Box Geometry
Rigid body with box geometry

Box Geometry

box_geometry

Box geometry.

dimension

Vector3

Default: [1,1,1]

Width, height and depth of the box.

offset

Vector3

Default: [0,0,0]

Geometry offset.

Plane

Compatible with: static body, kinematic rigid body

Planes divide space into "above" and "below" them. Everything "below" the plane will collide with it.

Plane Geometry
Static body with plane geometry

Plane Geometry

plane_geometry

Plane geometry.

distance

Float

Default: 0

Distance from the origin in the plane's normal direction.

normal

Vector3

Default: [0,1,0]

Normal of the plane.

Sphere

Compatible with: static body, rigid body, kinematic rigid body

Sphere Geometry
Rigid body with sphere geometry

Sphere Geometry

sphere_geometry

Sphere geometry.

offset

Vector3

Default: [0,0,0]

Geometry offset.

radius

Float

Default: 0.5

Radius of the sphere.

Cylinder

Compatible with: static body, rigid body, kinematic rigid body

Cylinder Geometry
Rigid body with cylinder geometry

Cylinder Geometry

cylinder_geometry

Cylinder geometry.

axis

Integer

[0] X-Axis

[1] Y-Axis

[2] Z-Axis

Default: [1] Y-Axis

Alignment axis. 0 for X, 1 for Y, 2 for Z.

height

Float

Default: 1

Height of the cylinder.

offset

Vector3

Default: [0,0,0]

Geometry offset.

radius

Float

Default: 0.5

Radius of the cylinder.

Capsule

Compatible with: static body, rigid body, kinematic rigid body, character controller

Capsule Geometry
Character controller with capsule geometry

Capsule Geometry

capsule_geometry

Capsule geometry.

axis

Integer

[0] X-Axis

[1] Y-Axis

[2] Z-Axis

Default: [1] Y-Axis

Alignment axis. 0 for X, 1 for Y, 2 for Z.

height

Float

Default: 1

Height of the cylindrical part of the capsule.

offset

Vector3

Default: [0,0,0]

Geometry offset.

radius

Float

Default: 0.5

Radius of the spheres at each end of the capsule.

Collision Geometry

Compatible with: Read below

Collision Geometry Reference

collision_geometry_ref

Reference to a collision geometry.

collisionGeometryRef

Asset UUID

UUID of the referenced collision geometry.


If you want to use a triangular mesh or a convex mesh as a geometry for your physics body, you need to create a collision geometry. A collision geometry is an asset that you can create from a mesh you provide it.

There are two types of collision geometry:

Convex

  • This is a convex mesh, that will encapsulate all the points of your mesh. A mesh is convex if, given any two points within it, the mesh contains the line between them.
  • Compatible with: static body, rigid body, kinematic rigid body

Triangular

  • This is a triangular mesh, that will encapsulate all the points of your mesh. It will wrap as closely to the original mesh you provide as possible.
  • Compatible with: static body, kinematic rigid body
Convex Collision Geometry
Static body with convex collision geometry
Triangular Collision Geometry
Static body with triangular collision geometry

Between the two, the convex collision geometry is the recommended default choice. A convex collision geometry is less computationally heavy as it contains less vertices than the triangular collision geometry. Also, triangular collision geometries cannot be assigned to rigid bodies.

To create a collision geometry, right click on an entity with a mesh reference component in your scene graph and select “Create convex collision geometry” or “Create triangular collision geometry”.

Create collision geometry from existing mesh
Create collision geometry from existing mesh

Once the collision geometry is created, your entity will be automatically assigned a collision geometry reference component and the collision geometry will be attached to it.