Api Sandbox ModelBuilder
class

ModelBuilder

public sealed class ModelBuilder

Provides ability to generate Models at runtime. A static instance of this class is available at Builder

Constructors

ModelBuilder()

Methods

AnimationBuilder AddAnimation(String name, Single frameRate)

Adds an animation to this model and returns a builder to construct the animation.

name — The name of the animation.
frameRate — The frames per second of the animation.
returns — An AnimationBuilder instance to construct the animation.
ModelBuilder WithMass(Single mass)

Total mass of the physics body (Default is 1000)

ModelBuilder WithSurface(String name)

Surface property to use for collision

ModelBuilder WithLodDistance(Int32 lod, Single distance)

LOD switch distance increment for each Level of Detail (LOD) level. (Default is 50)

ModelBuilder AddCollisionBox(Vector3 extents, Vector3? center = null, Rotation? rotation = null)
ModelBuilder AddCollisionSphere(Single radius, Vector3 center = null)

Add sphere collision shape.

ModelBuilder AddCollisionCapsule(Vector3 center0, Vector3 center1, Single radius)

Add capsule collision shape.

ModelBuilder AddCollisionHull(List<Vector3> vertices, Vector3? center = null, Rotation? rotation = null)
ModelBuilder AddCollisionHull(Span<Vector3> vertices, Vector3? center = null, Rotation? rotation = null)
ModelBuilder AddCollisionMesh(List<Vector3> vertices, List<Int32> indices)
ModelBuilder AddCollisionMesh(List<Vector3> vertices, List<Int32> indices, List<Byte> materials)
ModelBuilder AddCollisionMesh(Span<Vector3> vertices, Span<Int32> indices)
ModelBuilder AddCollisionMesh(Span<Vector3> vertices, Span<Int32> indices, Span<Byte> materials)
ModelBuilder AddTraceMesh(List<Vector3> vertices, List<Int32> indices)
ModelBuilder AddTraceMesh(Span<Vector3> vertices, Span<Int32> indices)
ModelBuilder AddMesh(Mesh mesh)

Add a mesh.

ModelBuilder AddMeshes(Mesh[] meshes)

Add a bunch of meshes.

ModelBuilder AddMesh(Mesh mesh, Int32 lod)

Add a mesh to a Level of Detail (LOD) group.

ModelBuilder AddMeshes(Mesh[] meshes, Int32 lod)

Add a bunch of meshes to a Level of Detail (LOD) group.

ModelBuilder AddMesh(Mesh mesh, String groupName, Int32 choiceIndex)

Add a mesh to a body group choice.

ModelBuilder AddMesh(Mesh mesh, Int32 lod, String groupName, Int32 choiceIndex)

Add a mesh to a Level of Detail (LOD) and a body group choice.

Void AddBone(Bone bone)

Add a bone to the skeleton via a Bone struct.

Void AddBones(Bone[] bones)

Add multiple bones to the skeleton.

ModelBuilder AddBone(String name, Vector3 position, Rotation rotation, String parentName = null)

Add a bone to the skeleton.

ModelBuilder AddAttachment(String name, Vector3 position, Rotation rotation, String parentName = null)

Add an attachment to the skeleton.

ModelBuilder WithName(String name)

Provide a name to identify the model by

name — Desired model name
ModelBuilder AddSurface(Surface surface)
Model Create()

Finish creation of the model.

MaterialGroupBuilder AddMaterialGroup(String name)

Add a named material group builder.

PhysicsBodyBuilder AddBody(Single mass = 0, Surface surface = null, String boneName = null)

Adds a new physics body to this object.

mass — The mass of the body. Default is 0.
surface — The surface properties to apply. Default is default.
boneName — Optional name of the bone this body is attached to. Leave empty for non-skeletal bodies.
returns — A new PhysicsBodyBuilder for configuring the body.
HingeJointBuilder AddHingeJoint(Int32 body1, Int32 body2, Transform? frame1 = null, Transform? frame2 = null, Boolean collision = False)
BallJointBuilder AddBallJoint(Int32 body1, Int32 body2, Transform? frame1 = null, Transform? frame2 = null, Boolean collision = False)
FixedJointBuilder AddFixedJoint(Int32 body1, Int32 body2, Transform? frame1 = null, Transform? frame2 = null, Boolean collision = False)
SliderJointBuilder AddSliderJoint(Int32 body1, Int32 body2, Transform? frame1 = null, Transform? frame2 = null, Boolean collision = False)
Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.ModelBuilder