# Sandbox.ModelBuilder

Provides the ability to generate [Sandbox.Model](/api/Sandbox.Model)s at runtime.
A new instance is available from [Sandbox.Model.Builder](/api/Sandbox.Model/Builder).

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Modifiers: sealed

## Constructors

- [`ModelBuilder`](/api/Sandbox.ModelBuilder/.ctor)

## Methods

- [`AddAnimation`](/api/Sandbox.ModelBuilder/AddAnimation): Adds an animation to this model and returns a builder to construct the animation. Duplicate names are given a numeric suffix. Animations without frames are omitted from the finished model.
- [`AddAttachment`](/api/Sandbox.ModelBuilder/AddAttachment): Adds a named attachment point to the skeleton.
- [`AddBallJoint`](/api/Sandbox.ModelBuilder/AddBallJoint)
- [`AddBody`](/api/Sandbox.ModelBuilder/AddBody): Adds a physics body to the model. Joints refer to bodies by the order they are added.
- [`AddBone`](/api/Sandbox.ModelBuilder/AddBone): Adds a bone to the skeleton.
- [`AddBones`](/api/Sandbox.ModelBuilder/AddBones): Adds multiple bones to the skeleton.
- [`AddCollisionBox`](/api/Sandbox.ModelBuilder/AddCollisionBox)
- [`AddCollisionCapsule`](/api/Sandbox.ModelBuilder/AddCollisionCapsule): Adds a capsule collision shape.
- [`AddCollisionHull`](/api/Sandbox.ModelBuilder/AddCollisionHull)
- [`AddCollisionMesh`](/api/Sandbox.ModelBuilder/AddCollisionMesh)
- [`AddCollisionSphere`](/api/Sandbox.ModelBuilder/AddCollisionSphere): Adds a sphere collision shape.
- [`AddFixedJoint`](/api/Sandbox.ModelBuilder/AddFixedJoint)
- [`AddHingeJoint`](/api/Sandbox.ModelBuilder/AddHingeJoint)
- [`AddHitboxSet`](/api/Sandbox.ModelBuilder/AddHitboxSet): Adds a named hitbox set.
- [`AddMaterialGroup`](/api/Sandbox.ModelBuilder/AddMaterialGroup): Adds a named material variant and returns a builder for its materials.
- [`AddMesh`](/api/Sandbox.ModelBuilder/AddMesh): Adds a mesh that is visible at every LOD level and in every body group.
- [`AddMeshes`](/api/Sandbox.ModelBuilder/AddMeshes): Adds multiple meshes that are visible at every LOD level and in every body group.
- [`AddSliderJoint`](/api/Sandbox.ModelBuilder/AddSliderJoint)
- [`AddSurface`](/api/Sandbox.ModelBuilder/AddSurface): Adds a surface that can be referenced by collision mesh material indices.
- [`AddTraceMesh`](/api/Sandbox.ModelBuilder/AddTraceMesh)
- [`Create`](/api/Sandbox.ModelBuilder/Create): Builds the model.
- [`WithEyePosition`](/api/Sandbox.ModelBuilder/WithEyePosition): Sets the model-space position used as the model's eye position.
- [`WithHullBounds`](/api/Sandbox.ModelBuilder/WithHullBounds): Sets the bounds used for physics and gameplay queries. If not set, the bounds are calculated from the model's physics data.
- [`WithLodDistance`](/api/Sandbox.ModelBuilder/WithLodDistance): Sets the distance at which an LOD level becomes active. By default, each level switches at `lod * 50`.
- [`WithMass`](/api/Sandbox.ModelBuilder/WithMass): Sets the mass, in kilograms, used by collision shapes added directly to this builder. The default is 1000.
- [`WithMaxEyeDeflection`](/api/Sandbox.ModelBuilder/WithMaxEyeDeflection): Sets the maximum angle, in degrees, that the model's eyes can turn away from forward.
- [`WithName`](/api/Sandbox.ModelBuilder/WithName): Sets the name used to identify the model.
- [`WithSurface`](/api/Sandbox.ModelBuilder/WithSurface): Sets the surface used by collision shapes added directly to this builder.
- [`WithViewBounds`](/api/Sandbox.ModelBuilder/WithViewBounds): Sets the bounds used for rendering and visibility. If not set, the bounds are calculated from the model's meshes.
