Struct VoxelGridCell
Namespace: AnyPath.Graphs.VoxelGrid
Assembly: AnyPath.dll
Syntax
public struct VoxelGridCell : IEquatable<VoxelGridCell>, INodeFlags
Constructors
VoxelGridCell(int3, float, int)
Creates a square grid cell
Declaration
public VoxelGridCell(int3 position, float enterCost = 0, int flags = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| int3 | position | Position of this cell. If you're using this as a query start, only the position is sufficient. |
| float | enterCost | Optional extra cost for entering this cell |
| int | flags | Optional flags for this cell |
VoxelGridCell(Vector3Int, float, int)
Creates a square grid cell
Declaration
public VoxelGridCell(Vector3Int position, float enterCost = 0, int flags = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Int | position | Position of this cell, note that the Z value is not used. If you're using this as a query start, only the position is sufficient. |
| float | enterCost | Optional extra cost for entering this cell |
| int | flags | Optional flags for this cell |
Properties
EnterCost
The cost associated with entering this cell. Note that this is additional to the distance and should not be a negative value.
Declaration
public readonly float EnterCost { get; }
Property Value
| Type | Description |
|---|---|
| float |
Flags
Flags for this location. Can be used in conjunction with FlagBitmask<TNode>.
Declaration
public int Flags { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| int |
IsOpen
Returns wether this cell is "walkable", that is, the EnterCost is not infinity.
Declaration
public bool IsOpen { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Position
Coordinate of this cell
Declaration
public readonly int3 Position { get; }
Property Value
| Type | Description |
|---|---|
| int3 |
Methods
GetDirection(in VoxelGridCell, in VoxelGridCell)
Returns the direction from one cell to another.
Declaration
public static VoxelGridDirectionFlags GetDirection(in VoxelGridCell from, in VoxelGridCell to)
Parameters
| Type | Name | Description |
|---|---|---|
| VoxelGridCell | from | |
| VoxelGridCell | to |
Returns
| Type | Description |
|---|---|
| VoxelGridDirectionFlags |
ToVector3()
Declaration
public Vector3 ToVector3()
Returns
| Type | Description |
|---|---|
| Vector3 |
Operators
implicit operator int3(VoxelGridCell)
Implicitly convert this location to an int2 value.
Declaration
public static implicit operator int3(VoxelGridCell cell)
Parameters
| Type | Name | Description |
|---|---|---|
| VoxelGridCell | cell |
Returns
| Type | Description |
|---|---|
| int3 |
implicit operator Vector3Int(VoxelGridCell)
Implicitly convert this location to an Vector2Int value.
Declaration
public static implicit operator Vector3Int(VoxelGridCell cell)
Parameters
| Type | Name | Description |
|---|---|---|
| VoxelGridCell | cell |
Returns
| Type | Description |
|---|---|
| Vector3Int |