Api Sandbox SceneObject
class

SceneObject

public class SceneObject

A model scene object that can be rendered within a SceneWorld.

Constructors

SceneObject(SceneWorld sceneWorld, Model model)
SceneObject(SceneWorld sceneWorld, Model model, Transform transform)
SceneObject(SceneWorld sceneWorld, String modelName, Transform transform)
SceneObject(SceneWorld sceneWorld, String modelName)

Properties

Name Type Description
Attributes RenderAttributes
World SceneWorld The scene world this object belongs to.
Transform Transform Transform of this scene object, relative to its Parent, or SceneWorld if parent is not set.
Rotation Rotation Rotation of this scene object, relative to its Parent, or SceneWorld if parent is not set.
Position Vector3 Position of this scene object, relative to its Parent, or SceneWorld if parent is not set.
Bounds BBox Set or get the axis aligned bounding box for this object.
LocalBounds BBox Set the axis aligned bounding box by transforming by this objects transform.
RenderingEnabled Boolean Whether this scene object should render or not.
ColorTint Color Color tint of this scene object.
Parent SceneObject Movement parent of this scene object, if any.
Model Model The model this scene object will render.
MeshGroupMask UInt64 State of all bodygroups of this object's model. You might be looking for Int32).
Batchable Boolean This object is not batchable by material for some reason ( example: has dynamic attributes that affect rendering )
Flags SceneObjectFlagAccessor Access to various advanced scene object flags.
RenderLayer SceneRenderLayer For a layer to draw this object, the target layer must match (or be unset) and the flags must match
Tags ITagSet List of tags for this scene object.

Methods

Void Delete()

Delete this scene object. You shouldn't access it anymore.

Void AddChild(String name, SceneObject child)

Add a named child scene object to this one. The child scene object will have its parent set.

Void RemoveChild(SceneObject child)

Unlink given scene object as a child from this one. The child scene object will have its parent set to null. It will not be deleted.

Void SetMaterialOverride(Material material)

Override all materials on this object's Model.

Void ClearMaterialOverride()

Clear all material replacements.

Void SetMaterialOverride(Material material, String attributeName, Int32 attributeValue = 1)

Replaces all materials of the model that have the given User Material Attribute set to "1", with given material. The system checks both the models' default material group materials and the materials of the active material group.

material — Material to replace with.
attributeName — Name of the User Material Attribute to test on each material of the model. They are set in the Material Editor's Attributes tab.
attributeValue — Value of the attribute to test for.
Void SetMaterialGroup(String name)

Set material group to replace materials of the model as set up in ModelDoc.

Void SetComponentSource(Component c)
GameObject GetGameObject()

Fields

Name Type Description
ClipPlane Plane Clipping plane for this scene object. Requires ClipPlaneEnabled to be true.
ClipPlaneEnabled Boolean Whether or not to use the clipping plane defined in ClipPlane.
Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.SceneObject