04-10 10:56
Notice
Recent Posts
Recent Comments
관리 메뉴

Scientific Computing & Data Science

Line Rendering Script 본문

CG & Video Games/Unity 3D

Line Rendering Script

cinema4dr12 2013. 5. 25. 10:27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using UnityEngine;
using System.Collections;
  
public class Line_Animation : MonoBehaviour {
    public        GameObject Target1;
    public        GameObject Target2;
    public         Material mtl;
    public Color lcolor;
    // Use this for initialization
      
    void Awake()
    {
        this.renderer.material = mtl;
    }
     
    void Start () {
        LineRenderer raspberry = gameObject.AddComponent<LineRenderer>();
        raspberry.SetWidth(0.05f,0.05f);
        raspberry.SetVertexCount(2);
        raspberry.SetColors(lcolor,lcolor);
        raspberry.material = mtl;
    }
      
    // Update is called once per frame
    void Update () {
        LineRenderer raspberry = GetComponent<LineRenderer>();
        raspberry.SetPosition(0,Target1.transform.position);
        raspberry.SetPosition(1,Target2.transform.positionf);
    }
}

'CG & Video Games > Unity 3D' 카테고리의 다른 글

VertextLit Shader  (0) 2013.05.26
Display Normal Shader  (0) 2013.05.26
Rendering with Different Cameras  (0) 2013.05.26
Movie Texture Script  (0) 2013.05.26
Random Number Generation in C#  (0) 2013.05.25
Comments