Skip to content

Primitive

Draws a generated 3D shape: cube, sphere, plane, cylinder, cone or torus.

Only the settings for the chosen Type are saved, in a child element named after the shape. The element for that shape has to be there, otherwise the component isn't added when the scene loads.

Scene file

Saved as a <Primitive> element inside the entity's <Entity> element. Attributes that are left out keep their default. See Scene Files for how values like vectors, colours and file paths are written.

<Primitive Type="0">
    <Material Filepath="Materials/Test.material"/>
    <Cube Width="1" Height="1" Depth="1"/>
</Primitive>
Name Where Type Default
Type attribute int: 0 Cube, 1 Sphere, 2 Plane, 3 Cylinder, 4 Cone, 5 Torus 0
Material child Filepath, optional path to a .material default material
Cube child Width Height Depth (float) 1, 1, 1
Sphere child Radius (float), LongitudeLines LatitudeLines (int) 0.5, 16, 32
Plane child Width Length TileU TileV (float), WidthLines LengthLines (int) 1, 1, 1, 1, 2, 2
Cylinder child BottomRadius TopRadius Height (float), SliceCount StackCount (int) 0.5, 0.5, 1, 32, 5
Cone child BottomRadius Height (float), SliceCount StackCount (int) 0.5, 1, 32, 5
Torus child OuterRadius InnerRadius (float), SliceCount (int) 1, 0.4, 32

In Lua, changing a size property such as CubeWidth doesn't rebuild the mesh. Call the matching function instead, for example primitive:SetCube(width, depth, height).

Lua scripting

Properties

  • ConeBottomRadius (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • ConeHeight (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • ConeSliceCount (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • ConeStackCount (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • CubeDepth (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • CubeHeight (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • CubeWidth (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • CylinderBottomRadius (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • CylinderHeight (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • CylinderSliceCount (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • CylinderStackCount (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • CylinderTopRadius (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • Material (Material): The material the shape is drawn with
  • Mesh (Mesh): The generated mesh
  • PlaneLength (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • PlaneLengthLines (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • PlaneTileU (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • PlaneTileV (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • PlaneWidth (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • PlaneWidthLines (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • SphereLatitudeLines (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • SphereLongitudeLines (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • SphereRadius (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • TorusInnerRadius (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • TorusOuterRadius (number): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • TorusSliceCount (integer): Shape setting - doesn't rebuild the mesh; call the matching Set function to apply it
  • Type (integer (enum)): Shape as an integer: 0 Cube, 1 Sphere, 2 Plane, 3 Cylinder, 4 Cone, 5 Torus

Functions

  • SetCone(): Rebuild as a cone: (bottomRadius, height, sliceCount, stackCount)
  • SetCube(): Rebuild as a cube: (width, depth, height)
  • SetCylinder(): Rebuild as a cylinder: (bottomRadius, topRadius, height, sliceCount, stackCount)
  • SetPlane(): Rebuild as a plane: (width, length, widthLines, lengthLines, tileU, tileV)
  • SetSphere(): Rebuild as a sphere: (radius, longitudeLines, latitudeLines)
  • SetTorus(): Rebuild as a torus: (outerRadius, innerRadius, sliceCount)
  • SetType(): Rebuild as the given shape type, using its current settings