Class MeshDataFromMesh
Uses a mesh for an actual cell to generate full mesh data for a grid.
[CreateAssetMenu(fileName = "MeshData", menuName = "Grids/MeshData/From Mesh")]
[Version(2, 3, 0)]
public class MeshDataFromMesh : MeshData
- Inheritance
-
MeshDataFromMesh
- Inherited Members
-
Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.nameObject.hideFlags
Remarks
This class is suitable for uniform grids with complicated cells.
Fields
mesh
The mesh to use for a cell.
public Mesh mesh
Field Value
scale
The scaling factor to apply to the mesh to get it to "standard" scale. Standard scale for 1 square cell is 1 by 1 unit. If your mesh is 2by2 units, you can use a scale of 0.5 to get correct results.
public float scale
Field Value
Methods
GetNormals(IExplicitShape<GridPoint2>, GridMap<GridPoint2>, bool)
Gets the normals for the given shape.
public override IEnumerable<Vector3> GetNormals(IExplicitShape<GridPoint2> explicitShape, GridMap<GridPoint2> gridMap, bool flip)
Parameters
explicitShape
IExplicitShape<GridPoint2>gridMap
GridMap<GridPoint2>The grid map to be used to calculate normals.
flip
boolWhether normals should be flipped or not.
Returns
Remarks
implement
Override this method to support 1D grids.
GetNormals(IExplicitShape<GridPoint3>, GridMap<GridPoint3>, bool)
Gets the normals for the given shape.
public override IEnumerable<Vector3> GetNormals(IExplicitShape<GridPoint3> explicitShape, GridMap<GridPoint3> gridMap, bool flip)
Parameters
explicitShape
IExplicitShape<GridPoint3>gridMap
GridMap<GridPoint3>The grid map to be used to calculate normals.
flip
boolWhether normals should be flipped or not.
Returns
Remarks
implement
Override this method to support 1D grids.
GetNormals(IExplicitShape<int>, GridMap<int>, bool)
Gets the normals for the given shape.
public override IEnumerable<Vector3> GetNormals(IExplicitShape<int> shape, GridMap<int> map, bool flip)
Parameters
shape
IExplicitShape<int>The shape for which to return the normals of.
map
GridMap<int>flip
boolWhether normals should be flipped or not.
Returns
Remarks
implement
Override this method to support 1D grids.
GetTriangles(IExplicitShape<GridPoint2>, bool, bool)
Gets a list of triangle indices for the given shape.
public override IEnumerable<int> GetTriangles(IExplicitShape<GridPoint2> shape, bool doubleSided, bool flip)
Parameters
shape
IExplicitShape<GridPoint2>The shape for which vertices should be returned.
doubleSided
boolWhether the returned triangles should be double sided.
flip
boolWhether the returned triangles should be flipped.
Returns
Remarks
implement
Override this method to support 1D grids.
GetTriangles(IExplicitShape<GridPoint3>, bool, bool)
Gets a list of triangle indices for the given shape.
public override IEnumerable<int> GetTriangles(IExplicitShape<GridPoint3> shape, bool doubleSided, bool flip)
Parameters
shape
IExplicitShape<GridPoint3>The shape for which vertices should be returned.
doubleSided
boolWhether the returned triangles should be double sided.
flip
boolWhether the returned triangles should be flipped.
Returns
Remarks
implement
Override this method to support 1D grids.
GetTriangles(IExplicitShape<int>, bool, bool)
Gets a list of triangle indices for the given shape.
public override IEnumerable<int> GetTriangles(IExplicitShape<int> shape, bool doubleSided, bool flip)
Parameters
shape
IExplicitShape<int>The shape for which vertices should be returned.
doubleSided
boolWhether the returned triangles should be double sided.
flip
boolWhether the returned triangles should be flipped.
Returns
Remarks
implement
Override this method to support 1D grids.
GetUVs(IExplicitShape<GridPoint2>)
Gets the UVs for the given shape.
public override IEnumerable<Vector2> GetUVs(IExplicitShape<GridPoint2> shape)
Parameters
shape
IExplicitShape<GridPoint2>The shape for which UVs should be returned.
Returns
Remarks
implement
Override this method to support 1D grids.
GetUVs(IExplicitShape<GridPoint3>)
Gets the UVs for the given shape.
public override IEnumerable<Vector2> GetUVs(IExplicitShape<GridPoint3> shape)
Parameters
shape
IExplicitShape<GridPoint3>The shape for which UVs should be returned.
Returns
Remarks
implement
Override this method to support 1D grids.
GetUVs(IExplicitShape<int>)
Gets the UVs for the given shape.
public override IEnumerable<Vector2> GetUVs(IExplicitShape<int> shape)
Parameters
shape
IExplicitShape<int>The shape for which UVs should be returned.
Returns
Remarks
implement
Override this method to support 1D grids.
GetVertices(IExplicitShape<GridPoint2>, GridMap<GridPoint2>)
Gets a list of vertices of a mesh for the given shape.
public override IEnumerable<Vector3> GetVertices(IExplicitShape<GridPoint2> shape, GridMap<GridPoint2> map)
Parameters
shape
IExplicitShape<GridPoint2>The shape for which vertices should be returned.
map
GridMap<GridPoint2>The map the mesh should be created with, so that centers of cells for a grid point match the world space position returned by the map.
Returns
Remarks
implement
Override this method to support 1D grids.
GetVertices(IExplicitShape<GridPoint3>, GridMap<GridPoint3>)
Gets a list of vertices of a mesh for the given shape.
public override IEnumerable<Vector3> GetVertices(IExplicitShape<GridPoint3> shape, GridMap<GridPoint3> map)
Parameters
shape
IExplicitShape<GridPoint3>The shape for which vertices should be returned.
map
GridMap<GridPoint3>The map the mesh should be created with, so that centers of cells for a grid point match the world space position returned by the map.
Returns
Remarks
implement
Override this method to support 1D grids.
GetVertices(IExplicitShape<int>, GridMap<int>)
Gets a list of vertices of a mesh for the given shape.
public override IEnumerable<Vector3> GetVertices(IExplicitShape<int> shape, GridMap<int> map)
Parameters
shape
IExplicitShape<int>The shape for which vertices should be returned.
map
GridMap<int>The map the mesh should be created with, so that centers of cells for a grid point match the world space position returned by the map.
Returns
Remarks
implement
Override this method to support 1D grids.