Рендер линии (Line Renderer)
Line Renderer принимает массив из двух или более точек трехмерного пространства и последовательно рисует прямую линию между каждой парой точек (т.е. при 3 и более точках получится ломаная). Таким образом один рендер линии может быть использован для рисования чего угодно, начиная от простой прямой линии и заканчивая сложной спиралью. Линия всегда непрерывна; т.е. если вам нужно создать две или более независимых линий, то следует создать несколько GameObject’ов, а каждый GameObject будет содержать свой рендер линии.
Рендер линии рисует линию толщиной более одного пикселя. Рендер линии рисует полоску, которая имеет ширину и которая может быть текстурирована. Рендер использует тот же алгоритм рисования линии, что и рендер шлейфа.
Свойство: | Функция: |
---|---|
Cast Shadows | Determines whether the line casts shadows, whether they should be cast from one or both sides of the line, or whether the line should only cast shadows and not otherwise be drawn. See Renderer-shadowCastingMode in the Script Ref to learn more. |
Recieve Shadows | If enabled, the line receives shadows. |
Motion Vectors | If enabled, the line has motion vectors rendered into the Camera motion vector Texture. See Renderer.motionVectors in the Scripting API reference documentation to learn more. |
Materials | These properties describe an array of Materials used for rendering the line. The line will be drawn once for each material in the array. |
Light Parameters | Reference a Lightmap Parameters Asset here to enable the line to interact with the global illumination system. |
Positions | Массив точек типа Vector3 для соединения в линию. |
Size | Количество сегментов линии. |
Parameters | Список параметров линии: |
Start Width | Ширина начала линии. |
End Width | Ширина конца линии. |
Start Color | Color at the first line position. Note: This has no effect unless the attached material uses a vertex shader. |
End Color | Color at the last line position. Note: This has no effect unless the attached material uses a vertex shader. |
Use World Space | If enabled, the points are considered as world-space coordinates, instead of being subject to the transform of the GameObject to which this component is attached. |
Reflection Probes | If enabled and reflection probes are present in the Scene, a reflection Texture is picked for this Line Renderer and set as a built-in Shader uniform variable. |
Детали
Для создания рендера линии:
Советы