zoukankan      html  css  js  c++  java
  • 使用LineRender绘制网格线

    参考:https://www.xuanyusong.com/archives/561

    可用于场景内变化的坐标数据的测试(浮空地块顶点数据一直在变 )

     1 using System.Collections;
     2 using System.Collections.Generic;
     3 using UnityEngine;
     4 
     5 public class TestLineRender : MonoBehaviour {
     6     private Vector3 v0 = new Vector3(1.0f, 0.0f, 0.0f);
     7     private Vector3 v1 = new Vector3(0.0f, 1.0f, 0.0f);
     8     private Vector3 v2 = new Vector3(0.0f, 0.0f, 1.0f);
     9 
    10     private LineRenderer lineRender = null;
    11 
    12     // Use this for initialization
    13     void Start () 
    14     {
    15         lineRender = gameObject.AddComponent<LineRenderer>();
    16         lineRender.material = new Material(Shader.Find("Sprites/Default"));
    17         lineRender.startColor = Color.blue;
    18         lineRender.endColor = Color.blue;
    19         lineRender.startWidth = 0.01f;
    20         lineRender.endWidth = 0.01f;
    21         lineRender.useWorldSpace = true;
    22         lineRender.positionCount = 4;
    23     }
    24 
    25     // Update is called once per frame
    26     void Update () 
    27     {
    28         lineRender.SetPosition(0, v0);
    29         lineRender.SetPosition(1, v1);
    30         lineRender.SetPosition(2, v2);
    31         lineRender.SetPosition(3, v0);
    32     }
    33 }
    改变自己
  • 相关阅读:
    DailyRollingFileAppender的使用
    CSS自动换行
    MAC与WIN10电脑共享文件
    C++常用STL
    Python机器学习及实践 课后小题
    Mac上利用VScode配置c/c++开发环境
    pycharm+anaconda在Mac上的配置方法 2019.11.29
    二分查找 python实现
    python3相关
    算法图解 各部分回忆
  • 原文地址:https://www.cnblogs.com/sun-shadow/p/14721181.html
Copyright © 2011-2022 走看看