Search Results for

    Show / Hide Table of Contents

    Class TerrainPatch

    Represents single terrain patch made of 16 terrain chunks.

    Inheritance
    System.Object
    Object
    TerrainPatch
    Implements
    ISerializable
    Inherited Members
    Object.__unmanagedPtr
    Object.__internalId
    Object.Finalize()
    Object.As<T>()
    Object.NewValue(Type)
    Object.New(String)
    Object.Find<T>(Guid, Boolean)
    Object.Find(Guid, Type, Boolean)
    Object.TryFind<T>(Guid)
    Object.TryFind(Guid, Type)
    Object.Destroy(Object, Single)
    Object.DestroyNow(Object)
    Object.Destroy<T>(T, Single)
    Object.Equals(Object)
    Object.GetUnmanagedPtr(Object)
    Object.GetUnmanagedInterface(Object, Type)
    Object.FromUnmanagedPtr(IntPtr)
    Object.MapObjectID(Guid)
    Object.RemapObjectID(Guid)
    Object.GetHashCode()
    Object.ID
    Object.TypeName
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public sealed class TerrainPatch : Object, ISerializable

    Constructors

    TerrainPatch()

    Initializes a new instance of the TerrainPatch.

    Declaration
    public TerrainPatch()

    Properties

    Heightfield

    Gets the heightfield collision data asset.

    Declaration
    [Unmanaged]
    public RawDataAsset Heightfield { get; }
    Property Value
    RawDataAsset

    Heightmap

    The heightmap texture.

    Declaration
    [Unmanaged]
    public Texture Heightmap { get; set; }
    Property Value
    Texture

    Methods

    ClosestPoint(ref Vector3, out Vector3)

    Gets a point on the terrain collider that is closest to a given location. Can be used to find a hit location or position to apply explosion force or any other special effects.

    Declaration
    [Unmanaged]
    public void ClosestPoint(ref Vector3 position, out Vector3 result)
    Parameters
    Vector3 position

    The position to find the closest point to it.

    Vector3 result

    The result point on the collider that is closest to the specified location.

    ExtractCollisionGeometry(out Float3[], out Int32[])

    Extracts the collision data geometry into list of triangles.

    Declaration
    [Unmanaged]
    public void ExtractCollisionGeometry(out Float3[] vertexBuffer, out int[] indexBuffer)
    Parameters
    Float3[] vertexBuffer

    The output vertex buffer.

    System.Int32[] indexBuffer

    The output index buffer.

    GetBounds()

    Gets the patch world bounds.

    Declaration
    [Unmanaged]
    public BoundingBox GetBounds()
    Returns
    BoundingBox

    GetChunk(ref Int2)

    Gets the chunk at the given location.

    Declaration
    [Unmanaged]
    public TerrainChunk GetChunk(ref Int2 chunkCoord)
    Parameters
    Int2 chunkCoord

    The chunk location (x and z).

    Returns
    TerrainChunk

    The chunk.

    GetChunk(Int32)

    Gets the chunk at the given index.

    Declaration
    [Unmanaged]
    public TerrainChunk GetChunk(int index)
    Parameters
    System.Int32 index

    The chunk zero-based index.

    Returns
    TerrainChunk

    The chunk.

    GetChunk(Int32, Int32)

    Gets the chunk at the given location.

    Declaration
    [Unmanaged]
    public TerrainChunk GetChunk(int x, int z)
    Parameters
    System.Int32 x

    The chunk location x.

    System.Int32 z

    The chunk location z.

    Returns
    TerrainChunk

    The chunk.

    GetHeightY()

    Gets the Y axis heightmap height.

    Declaration
    [Unmanaged]
    public float GetHeightY()
    Returns
    System.Single

    GetOffsetY()

    Gets the Y axis heightmap offset from terrain origin.

    Declaration
    [Unmanaged]
    public float GetOffsetY()
    Returns
    System.Single

    GetSplatmap(Int32)

    Gets the splatmap assigned to this patch.

    Declaration
    [Unmanaged]
    public Texture GetSplatmap(int index)
    Parameters
    System.Int32 index

    The zero-based index of the splatmap.

    Returns
    Texture

    The splatmap texture.

    GetTerrain()

    Gets the terrain.

    Declaration
    [Unmanaged]
    public Terrain GetTerrain()
    Returns
    Terrain

    GetX()

    Gets the x coordinate.

    Declaration
    [Unmanaged]
    public int GetX()
    Returns
    System.Int32

    GetZ()

    Gets the z coordinate.

    Declaration
    [Unmanaged]
    public int GetZ()
    Returns
    System.Int32

    RayCast(Vector3, Vector3, out RayCastHit, Single)

    Performs a raycast against terrain collision, returns results in a RaycastHit structure.

    Declaration
    [Unmanaged]
    public bool RayCast(Vector3 origin, Vector3 direction, out RayCastHit hitInfo, float maxDistance = 3.40282347E+38F)
    Parameters
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The normalized direction of the ray.

    RayCastHit hitInfo

    The result hit information. Valid only when method returns true.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    Returns
    System.Boolean

    True if ray hits an object, otherwise false.

    RayCast(Vector3, Vector3, out Single, out TerrainChunk, Single)

    Performs a raycast against this terrain collision shape. Returns the hit chunk.

    Declaration
    [Unmanaged]
    public bool RayCast(Vector3 origin, Vector3 direction, out float resultHitDistance, out TerrainChunk resultChunk, float maxDistance = 3.40282347E+38F)
    Parameters
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The normalized direction of the ray.

    System.Single resultHitDistance

    The raycast result hit position distance from the ray origin. Valid only if raycast hits anything.

    TerrainChunk resultChunk

    The raycast result hit chunk. Valid only if raycast hits anything.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    Returns
    System.Boolean

    True if ray hits an object, otherwise false.

    RayCast(Vector3, Vector3, out Single, out Vector3, Single)

    Performs a raycast against this terrain collision shape.

    Declaration
    [Unmanaged]
    public bool RayCast(Vector3 origin, Vector3 direction, out float resultHitDistance, out Vector3 resultHitNormal, float maxDistance = 3.40282347E+38F)
    Parameters
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The normalized direction of the ray.

    System.Single resultHitDistance

    The raycast result hit position distance from the ray origin. Valid only if raycast hits anything.

    Vector3 resultHitNormal

    The raycast result hit position normal vector. Valid only if raycast hits anything.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    Returns
    System.Boolean

    True if ray hits an object, otherwise false.

    RayCast(Vector3, Vector3, out Single, Single)

    Performs a raycast against this terrain collision shape.

    Declaration
    [Unmanaged]
    public bool RayCast(Vector3 origin, Vector3 direction, out float resultHitDistance, float maxDistance = 3.40282347E+38F)
    Parameters
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The normalized direction of the ray.

    System.Single resultHitDistance

    The raycast result hit position distance from the ray origin. Valid only if raycast hits anything.

    System.Single maxDistance

    The maximum distance the ray should check for collisions.

    Returns
    System.Boolean

    True if ray hits an object, otherwise false.

    SetSplatmap(Int32, Texture)

    Sets a splatmap to this patch.

    Declaration
    [Unmanaged]
    public void SetSplatmap(int index, Texture splatMap)
    Parameters
    System.Int32 index

    The zero-based index of the splatmap.

    Texture splatMap

    Splatmap texture.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.DeepClone<T>(T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat