---
title: "Add collision to an AI-generated model | Spatial Compiler"
description: "Get convex collision pieces that wrap your generated model in the same compile that cleans it up, plus the corners of every piece in a layout file."
canonical: https://appliedmanifold.com/use-cases/gen3d/add-collision/
site: "Applied Manifold: The spatial compute cloud for 3D reality"
---

1.  [Home](https://appliedmanifold.com/)
2.  [Use cases](https://appliedmanifold.com/use-cases/)
3.  [Generated models](https://appliedmanifold.com/use-cases/generated-models/)
4.  Add collision

# Add collision to your generated model

Generated models arrive with no collision, so characters and props pass straight through them. Spatial Compiler wraps the model in simple convex pieces in the same compile that cleans it up.

[Get Free API Key](https://console.appliedmanifold.com/sign-in?next=/api-keys&job=generated-model) [Start with your agent](https://appliedmanifold.com/use-cases/gen3d/add-collision/#get-started)

![The cleaned wagon with its texture](/use-cases/jobs/add-collision/before.webp)

![The same wagon wrapped in 64 cyan convex collision pieces](/use-cases/jobs/add-collision/after.webp)

Cleaned wagon

64 collision pieces

-   **64**convex pieces around the wagon
-   **About 2 min**to compile on the hosted API
-   **$5**Free signup credit for 50 mesh Drafts

Your physics engine tests these convex pieces for contact, in place of the 33,657 visible triangles.

## Collision that stays cheap

Physics engines check contact against shapes, and checking every visible triangle is slow. Most teams build boxes and capsules by hand in the editor for each asset.

A model with wheels, poles and a curved roof needs dozens of those shapes before it feels right to bump into.

## What the terms mean

-   ### Collider

    The invisible shape the physics engine uses for contact.

    Without one, characters walk through the model.

-   ### Convex piece

    A shape with no dents or holes, like a box or a pebble.

    Engines test convex shapes fast, so many small pieces can follow a complex outline.

-   ### Convex decomposition

    Splitting a model into convex pieces that together follow its outline.

    You get a close fit around wheels and handles without modeling it by hand.

## How it works

1.  ### Ask for collision

    Your agent sets the collision mode to convex pieces in the spec.

2.  ### Compile

    The same compile removes hidden faces and lightens the model. Your first 50 mesh Drafts are free with the $5 signup credit.

3.  ### Load it

    The GLB carries the pieces as colliders, and the layout file lists the corners of each piece in meters.

[Learn how convex hulls work](https://appliedmanifold.com/learn/convex-hull/)

## Questions

### How many collision pieces do I get?

The compile picks the count, up to 64 by default. The wagon used all 64.

### Can I get one simple shape instead?

Yes. Set the collision mode to box, sphere, capsule or hull to get a single shape around the whole model.

[All use cases](https://appliedmanifold.com/use-cases/)

## Use with your agent

Paste the prompt into Claude Code, Cursor or Codex. Your agent connects to Spatial Compiler and comes back with a cleaned GLB with convex collision pieces and a layout file that lists each piece.

[Get Free API Key](https://console.appliedmanifold.com/sign-in?next=/api-keys&job=generated-model) [Try it in the Playground →](https://console.appliedmanifold.com/playground?module=meshfx&item=namaqualand_rocks)

New accounts start with $5 of usage, and you see the price of each job before it runs.

Agent prompt

Connect the Spatial Compiler MCP server at https://spatialcompiler.dev/mcp if it isn't connected yet. Use meshfx to add convex collision pieces to my generated GLB in the same compile that cleans it up and sets it to real-world meters. Run a Draft first. Your first 50 mesh Drafts are free with the $5 signup credit. Ask before running a final compile.

Or add the server yourself in Claude Code:

`claude mcp add --transport http spatial-compiler https://spatialcompiler.dev/mcp`

[Set it up in Cursor, Codex or another agent](https://appliedmanifold.com/docs/mcp/)

Once connected, your agent can call the `starter` tool for a ready fire Draft spec and the exact call that runs it. Your first 100 fire Drafts are free with the $5 signup credit.
