画线以下团结C#对象 [英] drawing a line following an object in unity c#

查看:143
本文介绍了画线以下团结C#对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我用这个代码,以绘制如下对象

Hello I am using this code to draw a line that follows an object

Debug.DrawLine(new Vector3(gameObject.transform.position.x,     gameObject.transform.position.y, gameObject.transform.position.z),
        new Vector3(prevPosition_x, prevPosition_y, prevPosition_z), Color.red,1.0f);

    prevPosition_x = gameObject.transform.position.x;
    prevPosition_y = gameObject.transform.position.y;
    prevPosition_z = gameObject.transform.position.z;



然而,在构建这并不平局。有谁知道如何做到这一点,而不使用内置的线路或线索渲染器。我知道它可以与GL做,但没有一个线索如何做到这一点。

However this doesnt draw in a build. Does anyone know how to do this without using the built in line or trail renderers. I know it can be done with gl but dont have a clue how to do this.

任何帮助表示赞赏。

推荐答案

我相信Debug.DrawLine只能在场景编辑器。

I do believe Debug.DrawLine only works in the Scene Editor.

有几种方法可以绘制线条,GL肯定是其中之一。还有 Vectrosity

There are several ways you can draw lines, GL is definitely one of them. There is also Vectrosity.

唉,你可以自己通过生成自己的线网和移动顶点一些努力做到这一点。

Alas, you can do it yourself with some effort by generating your own line mesh and moving the vertices around.

希望它帮助。

这篇关于画线以下团结C#对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆