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 }
    改变自己
  • 相关阅读:
    sock编程
    Exceptional c++
    sort
    实现UDP高效接收/响应
    Iterator invalidation(迭代器失效)
    php 判断一个点是否在一个多边形区域内
    PHP 如何在txt里查找包含某个字符串的那一行?
    php 实现栈与队列
    微信支付 接口
    文章添加,删除,修改,分页列表
  • 原文地址:https://www.cnblogs.com/sun-shadow/p/14721181.html
Copyright © 2011-2022 走看看