栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 游戏开发 > Unity3D

Unity画线(Vectrosity5.6.1插件)

Unity3D 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Unity画线(Vectrosity5.6.1插件)

一个好的插件,会让你事半功倍,在Unity这个如此成熟的生态圈里,几乎常用的功能,都会有对应的插件帮助速简化开发工作,以最低的时间成本达到目的。接下来要介绍的是Unity的一款功能强大的画线插件:Vectrosity,如下图,提供了2D、3D画线、曲线等各种画线的封装,简单又相当实用。

这个插件在商城卖29.95美元

 我已经把它放到CSDN的网盘里了,有需要可以下载。

插件地址:最新版本的Vectrosity5.6.1+demo+中文使用文档-Actionscript文档类资源-CSDN下载

直接下载下来即可使用,所有画线方式都有demo,直接抄作业。

一、 2D画线方式:

引入Vectrosity包,接着简单两行代码即可完成画线:

// Use this method if you need more control than you get with Vector.SetLine
using UnityEngine;
using System.Collections.Generic;
using Vectrosity;

public class Line : MonoBehaviour {
	void Start () {
		// Make a Vector2 list; in this case we just use 2 elements...
		var linePoints = new List();
		linePoints.Add (new Vector2(0, Random.Range(0, Screen.height)));				// ...one on the left side of the screen somewhere
		linePoints.Add (new Vector2(Screen.width-1, Random.Range(0, Screen.height)));	// ...and one on the right
		
		// Make a VectorLine object using the above points, with a width of 2 pixels
		var line = new VectorLine("Line", linePoints, 2.0f);
		
		// Draw the line
		line.Draw();
	}
}

二、 3D画线也是同样简单

// See Simple3D 2.js for another way of doing this that uses TextAsset.bytes instead.
// If the vector object doesn't appear, make sure the scene view isn't visible while in play mode
using UnityEngine;
using Vectrosity;
using System.Collections.Generic;

public class Simple3D : MonoBehaviour {
	void Start () {
		// Make a Vector3 array that contains points for a cube that's 1 unit in size
		var cubePoints = new List{new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, -0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, 0.5f)};
		
		// Make a line using the above points, with a width of 2 pixels
		var line = new VectorLine(gameObject.name, cubePoints, 2.0f);
		
		// Make this transform have the vector line object that's defined above
		// This object is a rigidbody, so the vector object will do exactly what this object does
		VectorManager.ObjectSetup (gameObject, line, Visibility.Dynamic, Brightness.None);
	}
}

三、其他的画线方式,有需要的直接参照demo直接用即可。

最后分享下载地地址:最新版本的Vectrosity5.6.1+demo+中文使用文档-Actionscript文档类资源-CSDN下载

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/898352.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号