插件VectorLine

来源:互联网 发布:淘宝网app 电脑 编辑:程序博客网 时间:2024/05/24 05:10

插件VectorLine

  • 插件VectorLine
    • 简介
    • VectorLine函数
    • 常用Function

简介

VectorLine是一个强大的画线插件,提供丰富的接口,可以灵活地实现各种功能。

VectorLine函数

VectorLine (        name : String,        points : Vector2[] or Vector3[],        material : Material,        lineWidth : float,        lineType : LineType = LineType.Discrete,        joins : Joins = Joins.None) : VectorLine

根据参数创建一个VectorLine对象。lineWidth之后的参数是可选的,默认LineType为离散的。

public enum LineType{    Continuous = 0,    Discrete = 1,}public enum Joins{    Fill = 0,    Weld = 1,    None = 2,}

joins包含None、Fill、Weld。None为默认的,以标准矩形画线段,优先使用细线条。Fill填充可见的间断以角度,优先使用没有texture的细线条。Fill只在LineType.Continuous下起作用。Weld相似,用在连续线段顶点以焊接方式连接,更适合用在texture线条。Weld用在LineType.Discrete

常用Function

  • 渲染线条(2D):
function Draw () : void

如果line使用了Vector3,SetCamera3D会在第一次Draw( )时被自动调用。

  • 渲染线条(自动3D,跟随相机):
function Draw3DAuto (time : float = Mathf.Infinity) : void

每一帧自动更新line,无论相机怎么移动总会正确出现。

  • 得到点:
function GetPoint (distance : float) : Vector2

Returns a Vector2 in screen-space coordinates that corresponds to the given distance in the VectorLine.

  • 绘制圆:
function MakeCircle (        origin : Vector2 or Vector3,        up : Vector3 = Vector3.forward,        radius : float,        segments : int = all,        pointRotation : float = 0.0,        index : int = 0) : void
  • 绘制长方体:
function MakeCube (        origin : Vector3,        xSize : float,        ySize : float,        zSize : float,        index : int = 0) : void
  • 绘制bezier曲线:
function MakeCurve (        curvePoints : Vector2[] or Vector3[],        segments : int,        index : int = 0) : void
  • 绘制椭圆:
function MakeEllipse (        origin : Vector2 or Vector3,        up : Vector3 = Vector3.forward,        xRadius : float,        yRadius : float,        segments : int = all,        pointRotation : float = 0.0,        index : int = 0) : void
  • 绘制矩形:
function MakeRect (        rect : Rect,        index : int = 0) : void        function MakeRect (        topLeft : Vector2 or Vector3,        bottomRight : Vector2 or Vector3,        index : int = 0) : void
  • 绘制Catmull-Rom插值样条曲线:
function MakeSpline (        splinePoints : Vector2[] or Vector3[],        segments : int,        index : int = 0,        loop : boolean = false) : void
  • 设置颜色:
function SetColor (color : Color) : void
0 0
原创粉丝点击