Skip to content

Shapes

Bolt operates on shapes, the shape table holds information like radius for spheres, or half extents for boxes.

There are functions for every supported shape, as well as a function for getting the shape table from a BasePart.

bolt.create_from_part(part: BasePart, convex_radius: number?): Shape
bolt.create_box(size: Vector3, convex_radius: number?): BoxShape
bolt.create_sphere(radius: number, convex_radius: number?): SphereShape
bolt.create_ellipsoid(size: Vector3, convex_radius: number?): EllipsoidShape
bolt.create_capsule(radius: number, height: number, convex_radius: number?): CapsuleShape
bolt.create_cylinder(radius: number, height: number, convex_radius: number?): CylinderShape
bolt.create_wedge(size: Vector3, convex_radius: number?): WedgeShape
bolt.create_corner_wedge(size: Vector3, convex_radius: number?): CornerWedgeShape
bolt.create_mesh(mesh_info: {hulls: {Hull}, size: Vector3}, size: Vector3, convex_radius: number?): MeshShape

The convex radius optional parameter is only used for GJK shapecasts, it’s used to pad the two objects by a slight margin (that is removed from the resulting return values) for improved numerical robustness. The default value is 0.05, and it should ideally be based on the scale of the object, as this padding will be noticeable on the vertices and edges of the object for shapecasts. Sticking with a small value (like the default) is generally a good idea though.

bolt.resize_mesh(mesh: MeshShape, size: Vector3)

A resize method is specifically only needed for meshes as there is more work needed than a single value change for meshes.