s&box docs

public sealed class Sandbox.ModelBuilder

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

Constructors

Showing 1 constructors

Methods

Showing 34 methods

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

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

Parameters

  • name: The name of the animation.
  • frameRate: The frames per second of the animation.

Returns

An `Sandbox.AnimationBuilder` instance to construct the animation.

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

Add an attachment to the skeleton.

Parameters

  • parentName: Default: null

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

Parameters

  • frame1: Default: null
  • frame2: Default: null
  • collision: Default: False

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

Adds a new physics body to this object.

Parameters

  • mass: The mass of the body. Default is `0`. Default: 0
  • surface: The surface properties to apply. Default is `default`. Default: null
  • boneName: Optional name of the bone this body is attached to. Leave empty for non-skeletal bodies. Default: null

Returns

A new `Sandbox.PhysicsBodyBuilder` for configuring the body.

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

Add multiple bones to the skeleton.

public Sandbox.ModelBuilder AddCollisionBox(Vector3 extents, System.Nullable`1<Vector3> center = null, System.Nullable`1<Rotation> rotation = null)

Parameters

  • center: Default: null
  • rotation: Default: null

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

Add sphere collision shape.

Parameters

  • center: Default: null

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

Parameters

  • frame1: Default: null
  • frame2: Default: null
  • collision: Default: False

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

Parameters

  • frame1: Default: null
  • frame2: Default: null
  • collision: Default: False

public Sandbox.MaterialGroupBuilder AddMaterialGroup(string name)

Add a named material group builder.

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

Parameters

  • frame1: Default: null
  • frame2: Default: null
  • collision: Default: False

public Sandbox.Model Create()

Finish creation of the model.

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

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

public Sandbox.ModelBuilder WithMass(float mass)

Total mass of the physics body (Default is 1000)

public Sandbox.ModelBuilder WithName(string name)

Provide a name to identify the model by

Parameters

  • name: Desired model name

public Sandbox.ModelBuilder WithSurface(string name)

Surface property to use for collision

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.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