DOTS Geometry
 
Loading...
Searching...
No Matches
MeshUtil Class Reference

Static Public Member Functions

static Mesh CreateArrow2D (LineSegment2D segment, float thickness, float arrowHeadLength, float arrowHeadWidth, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a 2D Arrow from a line segment, with the arrow pointing towards the second vector of the segment. The thickness is the thickness of the shaft, while the arrowHeadWidth is the base width of the front triangle (while arrowHeadLength is the height of that triangle)
 
static Mesh CreateArrow3D (LineSegment3D segment, float thickness, float arrowHeadLength, float arrowHeadWidth, int circlePoints=8)
 Creates a 3D Arrow from a line segment, with the arrow pointing towards the second vector of the segment. The thickness is the thickness of the shaft, while the arrowHeadWidth is the base width of the front cone (while arrowHeadLength is the height of that cone)
 
static Mesh CreateBox (Bounds bounds, bool smooth=false)
 Creates a box mesh (cuboid)
 
static Mesh CreateBoxOutline (Bounds bounds, float thickness)
 Creates an outline of a box. Each side of the box will have a hollow rectangle as geometry (same as CreateRectangleOutline, but for each side of the box)
 
static Mesh CreateCircle (float radius, int circlePoints=32, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a circle mesh with a radius in the given cardinal plane.
 
static Mesh CreateCone (Cone cone, int circlePoints=32)
 
static Mesh CreateCylinder (Cylinder cylinder, int circlePoints=32)
 
static Mesh CreateGrid2D (Vector2 cellSize, int cellsX, int cellsY, float thickness, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a 2D Grid with a given number of cells in each direction of a plane.
 
static Mesh CreateGrid3D (Vector3 cellSize, int3 cells, float thickness)
 Creates a 3D Grid with a given number of cells in each direction of space.
 
static Mesh CreateInvertedBox (Bounds bounds)
 Creates a cube / box given with inverted faces.
 
static Mesh CreateLine (LineSegment2D segment, float thickness, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a line mesh (rectangle) defined by a 2D segment.
 
static Mesh CreateLine (LineSegment3D segment, float thickness, int circlePoints=8)
 Creates a line mesh (tube) defined by a 3D segment.
 
static Mesh CreateLineStrip (float2[] points, float thickness, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates piece-wise lines of width equal to the thickness, given a sequence of points.
 
static Mesh CreatePlane (Vector2 size, int cellsX, int cellsY, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a centered plane with a number of cells (subdivided plane)
 
static Mesh CreatePolygonMesh (NativePolygon2D polygon, List< int > triangulation, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a mesh from a given polygon (2D) and a triangulation (calculated by some algorithm)
 
static Mesh CreatePolygonMesh (NativePolygon2D polygon, NativeArray< int > triangulation, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a mesh from a given polygon (2D) and a triangulation (calculated by some algorithm)
 
static Mesh CreatePolygonOutline (NativePolygon2D polygon, float thickness, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 
static Mesh CreatePrism (NativePolygon2D basePolygon, NativeArray< int > triangulation, Vector3 offset, bool smoothMantle=false, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a 3D prism form a base polygon and an offset.
 
static Mesh CreateRectangle (Rect rect, CardinalPlane cardinalPlane=CardinalPlane.XZ, Vector2[] uvs=null, int uvChannel=0)
 Creates a rectangle mesh given by a rect in the given cardinal plane.
 
static Mesh CreateRectangleOutline (Rect rect, float thickness, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a hollow rectangle mesh (A rectangle with a rectangle hole inside)
 
static Mesh CreateRing (float radius, float thickness, int circlePoints=32, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a ring mesh with a radius and thickness in the given cardinal plane.
 
static Mesh CreateTetrahedron (Tetrahedron tetrahedron)
 
static Mesh CreateTetrahedronOutline (Tetrahedron tetrahedron, float thickness)
 
static Mesh CreateTorus (Torus torus, int minorCirclePoints=24, int majorCirclePoints=24)
 Creates a mesh of a torus.
 
static Mesh CreateTriangle (NativeTriangle2D triangle, CardinalPlane cardinalPlane=CardinalPlane.XZ)
 Creates a 2D triangle mesh. Clockwise is front.
 
static Mesh CreateTriangle (NativeTriangle3D triangle)
 Creates a 3D triangle mesh. Clockwise is front.
 
static Mesh CreateTriangleOutline (NativeTriangle3D triangle, float thickness)
 Creates a 3D triangle outline. Clockwise is front.
 
static Mesh CreateUVCapsule (float radius, float height, int uPoints=24, int vPointsPerSide=12)
 Creates an UV Capsule.
 
static Mesh CreateUVSphere (float radius, int uPoints=24, int vPoints=24)
 Creates an UV Sphere Mesh.
 

Member Function Documentation

◆ CreateArrow2D()

static Mesh CreateArrow2D ( LineSegment2D segment,
float thickness,
float arrowHeadLength,
float arrowHeadWidth,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a 2D Arrow from a line segment, with the arrow pointing towards the second vector of the segment. The thickness is the thickness of the shaft, while the arrowHeadWidth is the base width of the front triangle (while arrowHeadLength is the height of that triangle)

Parameters
segment
thickness
arrowHeadLength
arrowHeadWidth
cardinalPlane
Returns

◆ CreateArrow3D()

static Mesh CreateArrow3D ( LineSegment3D segment,
float thickness,
float arrowHeadLength,
float arrowHeadWidth,
int circlePoints = 8 )
static

Creates a 3D Arrow from a line segment, with the arrow pointing towards the second vector of the segment. The thickness is the thickness of the shaft, while the arrowHeadWidth is the base width of the front cone (while arrowHeadLength is the height of that cone)

Parameters
segment
thickness
arrowHeadLength
arrowHeadWidth
circlePoints
Returns

◆ CreateBox()

static Mesh CreateBox ( Bounds bounds,
bool smooth = false )
static

Creates a box mesh (cuboid)

Parameters
bounds
smoothIf true, the corner vertices are shared
Returns

◆ CreateBoxOutline()

static Mesh CreateBoxOutline ( Bounds bounds,
float thickness )
static

Creates an outline of a box. Each side of the box will have a hollow rectangle as geometry (same as CreateRectangleOutline, but for each side of the box)

Parameters
bounds
thickness
Returns

◆ CreateCircle()

static Mesh CreateCircle ( float radius,
int circlePoints = 32,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a circle mesh with a radius in the given cardinal plane.

Parameters
circlePoints
radius
Returns

◆ CreateGrid2D()

static Mesh CreateGrid2D ( Vector2 cellSize,
int cellsX,
int cellsY,
float thickness,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a 2D Grid with a given number of cells in each direction of a plane.

Parameters
cellSizeThe size of each cell
cellsXThe number of cells in the "X-Direction" (first direction in the cardinal plane)
cellsYThe number of cells in the "Y-Direction" (second direction in the cardinal plane)
thicknessThickness of the border of each cell
cardinalPlane
Returns
Exceptions
ArgumentException

◆ CreateGrid3D()

static Mesh CreateGrid3D ( Vector3 cellSize,
int3 cells,
float thickness )
static

Creates a 3D Grid with a given number of cells in each direction of space.

Parameters
cellSize
cells
thickness
Returns

◆ CreateInvertedBox()

static Mesh CreateInvertedBox ( Bounds bounds)
static

Creates a cube / box given with inverted faces.

Parameters
bounds
Returns

◆ CreateLine() [1/2]

static Mesh CreateLine ( LineSegment2D segment,
float thickness,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a line mesh (rectangle) defined by a 2D segment.

Parameters
segment
thickness
Returns

◆ CreateLine() [2/2]

static Mesh CreateLine ( LineSegment3D segment,
float thickness,
int circlePoints = 8 )
static

Creates a line mesh (tube) defined by a 3D segment.

Parameters
segment
thickness
circlePointsNumber of vertices around the tube
Returns

◆ CreateLineStrip()

static Mesh CreateLineStrip ( float2[] points,
float thickness,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates piece-wise lines of width equal to the thickness, given a sequence of points.

Parameters
points
thickness
cardinalPlane
Returns

◆ CreatePlane()

static Mesh CreatePlane ( Vector2 size,
int cellsX,
int cellsY,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a centered plane with a number of cells (subdivided plane)

Parameters
sizeThe size of the plane
cellsXNumber of cells in the "X-Direction" (first direction in the cardinal plane)
cellsYNumber of cells in the "Y-Direction" (second direction in the cardinal plane)
cardinalPlane
Returns

◆ CreatePolygonMesh() [1/2]

static Mesh CreatePolygonMesh ( NativePolygon2D polygon,
List< int > triangulation,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a mesh from a given polygon (2D) and a triangulation (calculated by some algorithm)

Parameters
polygon
triangulation
Returns

◆ CreatePolygonMesh() [2/2]

static Mesh CreatePolygonMesh ( NativePolygon2D polygon,
NativeArray< int > triangulation,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a mesh from a given polygon (2D) and a triangulation (calculated by some algorithm)

Parameters
polygon
triangulation
Returns

◆ CreatePrism()

static Mesh CreatePrism ( NativePolygon2D basePolygon,
NativeArray< int > triangulation,
Vector3 offset,
bool smoothMantle = false,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a 3D prism form a base polygon and an offset.

Parameters
basePolygonThe base polygon
triangulation
offsetThe offset where the other polygon is places
smoothMantleIf the mantle between the polygons should have smooth or non-smooth edges
cardinalPlane
Returns

◆ CreateRectangle()

static Mesh CreateRectangle ( Rect rect,
CardinalPlane cardinalPlane = CardinalPlane::XZ,
Vector2[] uvs = null,
int uvChannel = 0 )
static

Creates a rectangle mesh given by a rect in the given cardinal plane.

Parameters
rect
Returns

◆ CreateRectangleOutline()

static Mesh CreateRectangleOutline ( Rect rect,
float thickness,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a hollow rectangle mesh (A rectangle with a rectangle hole inside)

Parameters
rect
thicknessThe thickness of the border
Returns

◆ CreateRing()

static Mesh CreateRing ( float radius,
float thickness,
int circlePoints = 32,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a ring mesh with a radius and thickness in the given cardinal plane.

Parameters
circlePoints
radius
Returns

◆ CreateTorus()

static Mesh CreateTorus ( Torus torus,
int minorCirclePoints = 24,
int majorCirclePoints = 24 )
static

Creates a mesh of a torus.

Parameters
torus
minorCirclePoints
majorCirclePoints
Returns

◆ CreateTriangle() [1/2]

static Mesh CreateTriangle ( NativeTriangle2D triangle,
CardinalPlane cardinalPlane = CardinalPlane::XZ )
static

Creates a 2D triangle mesh. Clockwise is front.

Parameters
triangle
Returns

◆ CreateTriangle() [2/2]

static Mesh CreateTriangle ( NativeTriangle3D triangle)
static

Creates a 3D triangle mesh. Clockwise is front.

Parameters
triangle
Returns

◆ CreateTriangleOutline()

static Mesh CreateTriangleOutline ( NativeTriangle3D triangle,
float thickness )
static

Creates a 3D triangle outline. Clockwise is front.

Parameters
triangle
thickness
Returns

◆ CreateUVCapsule()

static Mesh CreateUVCapsule ( float radius,
float height,
int uPoints = 24,
int vPointsPerSide = 12 )
static

Creates an UV Capsule.

Parameters
radiusThe radius of the cylinder of the capsule
heightThe height of the cylinder of the capsule
uPointsThe number of vertices around the cylinder
vPointsPerSideThe number of
Returns

◆ CreateUVSphere()

static Mesh CreateUVSphere ( float radius,
int uPoints = 24,
int vPoints = 24 )
static

Creates an UV Sphere Mesh.

Parameters
radiusThe radius of the sphere
uPointsThe number of vertices around the equator
vPointsThe number of vertices from pole to pole
Returns