新建一个脚本,这个物体得挂在有摄像机组件的物体上才能生效 OnPostRender() 这个函数才会被自动调用(类似生命周期自动调用) 然后就可以代码画线了,原理是openGL的画线 using UnityEngine; using System.Collections; using System.Collections.Generic; /// <summary> /// GL画图 /// </summary> public class GLDraw : UnityNormalS
using UnityEngine; using System.Collections; public class TGLLine : MonoBehaviour { private static Material mat; void Start () { CreateLineMaterial(); } void Update () { } //画线框用的mat public static Material CreateLineMaterial(){ mat = new Material("Sh
using UnityEngine; using System.Collections; using System.Collections.Generic; [ExecuteInEditMode] public class Parabola : MonoBehaviour { //重力 [Range(,)] public float gravity = 0.13f; //最大长度 ; //两点之间的距离 const float length = 0.2f; //点集合 List<Vector3>