ModelBuilderclass

Provides ability to generate `Sandbox.Model`s at runtime. A static instance of this class is available at `Sandbox.Model.Builder`

objectModelBuilder
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.ModelBuilder

Constructors1

Showing 1 constructors

Methods34

Showing 34 methods

public Sandbox.AnimationBuilder AddAnimation(string name, float frameRate)PUBLIC

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

ParameterTypeDescription
namestringThe name of the animation.
frameRatefloatThe frames per second of the animation.
Returns:AnimationBuilderAn `Sandbox.AnimationBuilder` instance to construct the animation.

public Sandbox.ModelBuilder AddAttachment(string name, Vector3 position, Rotation rotation, string parentName = null)PUBLIC

Add an attachment to the skeleton.

ParameterTypeDescription
namestring
positionVector3
rotationRotation
parentName = nullstring
Returns:ModelBuilder

public Sandbox.BallJointBuilder AddBallJoint(int body1, int body2, System.Nullable`1<Transform> frame1 = null, System.Nullable`1<Transform> frame2 = null, bool collision = False)PUBLIC

ParameterTypeDescription
body1int
body2int
frame1 = nullNullable<Transform>
frame2 = nullNullable<Transform>
collision = Falsebool
Returns:BallJointBuilder

public Sandbox.PhysicsBodyBuilder AddBody(float mass = 0, Sandbox.Surface surface = null, string boneName = null)PUBLIC

Adds a new physics body to this object.

ParameterTypeDescription
mass = 0floatThe mass of the body. Default is `0`.
surface = nullSurfaceThe surface properties to apply. Default is `default`.
boneName = nullstringOptional name of the bone this body is attached to. Leave empty for non-skeletal bodies.
Returns:PhysicsBodyBuilderA new `Sandbox.PhysicsBodyBuilder` for configuring the body.

public void AddBones(Sandbox.ModelBuilder.Bone[] bones)PUBLIC

Add multiple bones to the skeleton.

ParameterTypeDescription
bonesBone[]
Returns:void

public Sandbox.ModelBuilder AddCollisionSphere(float radius, Vector3 center = null)PUBLIC

Add sphere collision shape.

ParameterTypeDescription
radiusfloat
center = nullVector3
Returns:ModelBuilder

public Sandbox.FixedJointBuilder AddFixedJoint(int body1, int body2, System.Nullable`1<Transform> frame1 = null, System.Nullable`1<Transform> frame2 = null, bool collision = False)PUBLIC

ParameterTypeDescription
body1int
body2int
frame1 = nullNullable<Transform>
frame2 = nullNullable<Transform>
collision = Falsebool

public Sandbox.HingeJointBuilder AddHingeJoint(int body1, int body2, System.Nullable`1<Transform> frame1 = null, System.Nullable`1<Transform> frame2 = null, bool collision = False)PUBLIC

ParameterTypeDescription
body1int
body2int
frame1 = nullNullable<Transform>
frame2 = nullNullable<Transform>
collision = Falsebool

public Sandbox.Model Create()PUBLIC

Finish creation of the model.

Returns:Model

public Sandbox.ModelBuilder WithLodDistance(int lod, float distance)PUBLIC

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

ParameterTypeDescription
lodint
distancefloat
Returns:ModelBuilder

public Sandbox.ModelBuilder WithMass(float mass)PUBLIC

Total mass of the physics body (Default is 1000)

ParameterTypeDescription
massfloat
Returns:ModelBuilder

public Sandbox.ModelBuilder WithName(string name)PUBLIC

Provide a name to identify the model by

ParameterTypeDescription
namestringDesired model name
Returns:ModelBuilder

public Sandbox.ModelBuilder WithSurface(string name)PUBLIC

Surface property to use for collision

ParameterTypeDescription
namestring
Returns:ModelBuilder

On this page

Constructorspublic ModelBuilder()Methodspublic Sandbox.AnimationBuilder AddAnimation(System.String name, System.Single frameRate)public Sandbox.ModelBuilder AddAttachment(System.String name, Vector3 position, Rotation rotation, System.String parentName = null)public Sandbox.BallJointBuilder AddBallJoint(System.Int32 body1, System.Int32 body2, System.Nullable`1<Transform> frame1 = null, System.Nullable`1<Transform> frame2 = null, System.Boolean collision = False)public Sandbox.PhysicsBodyBuilder AddBody(System.Single mass = 0, Sandbox.Surface surface = null, System.String boneName = null)public System.Void AddBone(Sandbox.ModelBuilder.Bone bone)public Sandbox.ModelBuilder AddBone(System.String name, Vector3 position, Rotation rotation, System.String parentName = null)public System.Void AddBones(Sandbox.ModelBuilder.Bone[] bones)public Sandbox.ModelBuilder AddCollisionBox(Vector3 extents, System.Nullable`1<Vector3> center = null, System.Nullable`1<Rotation> rotation = null)public Sandbox.ModelBuilder AddCollisionCapsule(Vector3 center0, Vector3 center1, System.Single radius)public Sandbox.ModelBuilder AddCollisionHull(System.Collections.Generic.List`1<Vector3> vertices, System.Nullable`1<Vector3> center = null, System.Nullable`1<Rotation> rotation = null)public Sandbox.ModelBuilder AddCollisionHull(System.Span`1<Vector3> vertices, System.Nullable`1<Vector3> center = null, System.Nullable`1<Rotation> rotation = null)public Sandbox.ModelBuilder AddCollisionMesh(System.Collections.Generic.List`1<Vector3> vertices, System.Collections.Generic.List`1<System.Int32> indices, System.Collections.Generic.List`1<System.Byte> materials)public Sandbox.ModelBuilder AddCollisionMesh(System.Collections.Generic.List`1<Vector3> vertices, System.Collections.Generic.List`1<System.Int32> indices)public Sandbox.ModelBuilder AddCollisionMesh(System.Span`1<Vector3> vertices, System.Span`1<System.Int32> indices, System.Span`1<System.Byte> materials)public Sandbox.ModelBuilder AddCollisionMesh(System.Span`1<Vector3> vertices, System.Span`1<System.Int32> indices)public Sandbox.ModelBuilder AddCollisionSphere(System.Single radius, Vector3 center = null)public Sandbox.FixedJointBuilder AddFixedJoint(System.Int32 body1, System.Int32 body2, System.Nullable`1<Transform> frame1 = null, System.Nullable`1<Transform> frame2 = null, System.Boolean collision = False)public Sandbox.HingeJointBuilder AddHingeJoint(System.Int32 body1, System.Int32 body2, System.Nullable`1<Transform> frame1 = null, System.Nullable`1<Transform> frame2 = null, System.Boolean collision = False)public Sandbox.MaterialGroupBuilder AddMaterialGroup(System.String name)public Sandbox.ModelBuilder AddMesh(Sandbox.Mesh mesh, System.Int32 lod, System.String groupName, System.Int32 choiceIndex)public Sandbox.ModelBuilder AddMesh(Sandbox.Mesh mesh, System.Int32 lod)public Sandbox.ModelBuilder AddMesh(Sandbox.Mesh mesh, System.String groupName, System.Int32 choiceIndex)public Sandbox.ModelBuilder AddMesh(Sandbox.Mesh mesh)public Sandbox.ModelBuilder AddMeshes(Sandbox.Mesh[] meshes, System.Int32 lod)public Sandbox.ModelBuilder AddMeshes(Sandbox.Mesh[] meshes)public Sandbox.SliderJointBuilder AddSliderJoint(System.Int32 body1, System.Int32 body2, System.Nullable`1<Transform> frame1 = null, System.Nullable`1<Transform> frame2 = null, System.Boolean collision = False)public Sandbox.ModelBuilder AddSurface(Sandbox.Surface surface)public Sandbox.ModelBuilder AddTraceMesh(System.Collections.Generic.List`1<Vector3> vertices, System.Collections.Generic.List`1<System.Int32> indices)public Sandbox.ModelBuilder AddTraceMesh(System.Span`1<Vector3> vertices, System.Span`1<System.Int32> indices)public Sandbox.Model Create()public Sandbox.ModelBuilder WithLodDistance(System.Int32 lod, System.Single distance)public Sandbox.ModelBuilder WithMass(System.Single mass)public Sandbox.ModelBuilder WithName(System.String name)public Sandbox.ModelBuilder WithSurface(System.String name)Metadata