Class TycoonTileRaycastHit
Represents a raycast hit on a TycoonTile terrain.
Namespace: TycoonTerrain.Core
Assembly: TycoonTerrainAssembly.dll
Syntax
public class TycoonTileRaycastHit
Properties
IsCliff
Indicates whether the raycast hit was hit on a tile cliff.
Declaration
public bool IsCliff { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsSurface
Indicates whether the raycast hit was hit on a tile surface.
Declaration
public bool IsSurface { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Normal
Returns the normal at the hit position.
Declaration
public float3 Normal { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.float3 | The hit normal. |
SurfacePosition
Returns the surface position of the hit in world space.
Declaration
public float3 SurfacePosition { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.float3 | The surface position at the hit position. |
Terrain
The tile map instance that was hit by the raycast.
Declaration
public TycoonTileMap Terrain { get; }
Property Value
Type | Description |
---|---|
TycoonTileMap | The tile map instance that was hit by the raycast. |
Tile
The tile handle of the tile that was hit by the raycast.
Declaration
public TileHandle Tile { get; }
Property Value
Type | Description |
---|---|
TileHandle | The tile handle of the tile that was hit by the raycast. |
TileLocalPosition
The local tile position, where x (west to east) and y (south to north) are in the range [0,1].
Declaration
public float2 TileLocalPosition { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.float2 | The local tile position. |
TilePosition
The tile position of the tile that was hit.
Declaration
public int2 TilePosition { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.int2 | The tile position of the tile that was hit. |
WorldPosition
The world position of the hit.
Declaration
public float3 WorldPosition { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.float3 | The world position of the hit. |
Methods
FromCenter(float3)
Returns the position of the ray hit tile center with an optional offset.
Declaration
public float3 FromCenter(float3 offset = default(float3))
Parameters
Type | Name | Description |
---|---|---|
Unity.Mathematics.float3 | offset | The offset from the center. |
Returns
Type | Description |
---|---|
Unity.Mathematics.float3 | The center position of the selected tile in map coordinate space. |
MapToWorldPosition(float3)
Transforms the map position to the world position in the scene.
Declaration
public float3 MapToWorldPosition(float3 mapPosition)
Parameters
Type | Name | Description |
---|---|---|
Unity.Mathematics.float3 | mapPosition | The map position. |
Returns
Type | Description |
---|---|
Unity.Mathematics.float3 | The scene position in world space. |
SnapToCorners()
Returns the ray hit position snapped to the closest tile corner.
Declaration
public float3 SnapToCorners()
Returns
Type | Description |
---|---|
Unity.Mathematics.float3 | The map position snapped to the tile corners. |
SnapToEdge(Single)
Returns the ray hit position snapped to the closest tile edge. Optionally provide an horizontal offset.
Declaration
public float3 SnapToEdge(float offset = 0F)
Parameters
Type | Name | Description |
---|---|---|
Single | offset | The horizontal offset. Negative offset moves the position further into the tile, a positive offset moves it further outwards. |
Returns
Type | Description |
---|---|
Unity.Mathematics.float3 | The map position snapped to the closest edge of the selected tile. |
SnapToGrid(Int32)
Returns the snapped ray hit position using the number of tile grid subdivisions.
Declaration
public float3 SnapToGrid(int numberOfSubdivisions)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numberOfSubdivisions | The number of sub divisions to snap to. |
Returns
Type | Description |
---|---|
Unity.Mathematics.float3 | The map position snapped to the grid subdivided in the specified number of subdivisions. |