• Runtime features

    DotsGridTerrain support runtime modification of terrain height, holes, and small maps.When the height and holes of the terrain are modified, the corresponding physical components are modified synchronously.

    (1)Modify terrain height

    To modify the height of the terrain, you need to create a Entity and then attach the ModifyHeightSystem.Tag component.Please do not attach this component directly to any entity that you don't want to destroy.When the system is running, all Entity with this component are destroyed.This component requires 3 parameters:

    Center:The float3 type.Specifies the center point where the terrain needs to be modified.

    ModifyHeightShapeType:This is an enum that defines the shape of the modified terrain.There are currently two shapes defined: Box lifts vertexes through a rectangular shape, and sin uses a sinusoidal curve to lift vertexes.

    Description:float3 type, which describes the size and height of the shape.The XZ component specifies the distance from the center point, and the y component specifies the modified height value.Y component positive raises the vertex and negative lowers the vertex.

    (2)Modify the holes and implement the graffiti

    To implement both functions, you need to create a entity and add a PaintAndHoleSystem.Tag component.Please do not attach this component directly to any entity that you do not want to destroy.When the system is running, all entity s with this component are destroyed.This component includes 6 parameters.

    Center:The float3 type.Specifies the center point where the terrain needs to be modified.

    PaintShapeType:An enum type that specifies the shape of the painting.Rectangles or circles are currently defined.

    isHole:Specifies whether to make a hole.Whether or not, the system reproduces the collider.

    Description:The float3 type.Specifies the shape size of the painting.The XZ specifies the distance from the center point.When the Y component value is negative, the value of paintMap is ignored and the original display of the terrain is restored.There is no effect if the Y component value is greater than or equal to 0.

    paintMap:Specifies the image that needs to be painted by a doodle.When using this function, please try to ensure that the pixel size of the image reasonably matches the number of vertices within the range of influence, otherwise unreasonable results will occur.

    paintRange:The float4 type.This parameter specifies that that area of the copied image needs to be copied.The Xy component specifies the uv minimum of the replication region, and the wz component specifies the replication region maximum.This value works only if the paintmap is correctly assigned.

    Rotation: The float3 type.Rotation angle of the copied image.

    (3)Custom build colliders

    If you need to set custom rules to generate collision bodies, you first need to filter out terrain Entity that meet the custom rules.All terrain Entity s contain TerrainGridTag components which will help you achieve proper filtering.Secondly, the GenerateColliderSystem.Tag component is attached to the selected terrain entity.This component has a bool-type parameter that specifies whether the collider needs to be generated immediately.When its value is false, a job is opened to calculate the vertex information of the collision body, and then the current collision body is replaced.

    (4)Use the DotsTerrainGrid.MSG class

    As a tool, the call functions of the above functions are written in the DotsTerrainGrid.MSG class.Just need to call the corresponding API in this class.The script is located under the DotTerrainGrid / Scripts / Tool folder.Functions with different parameters of the same name apply to MonoBehaviour and to various scenarios of system under Dots.