Unity

Trail Renderer

코드버무려 2014. 8. 6. 14:03

Object 만들고, Componenet > Effects > Trail Renderer 로 비행기 항적 연기를 만들수 있다.



using UnityEngine;

using System.Collections;


public class CameraRig1 : MonoBehaviour {


public Transform target;

public Camera cam;


float yDistance;


public float lerpSpeed = 2f;


// Use this for initialization

void Start () {

yDistance = transform.position.y - target.position.y;

}

// Update is called once per frame

void Update () {

Debug.Log ("target pos: " +(target.position + Vector3.up*yDistance)

         +", my pos: " + transform.position

           +", lerp :" + lerpSpeed * Time.deltaTime);


transform.position 

= Vector3.Lerp (transform.position,

                                 target.position + Vector3.up*yDistance,

               lerpSpeed * Time.deltaTime);

//transform.position = target.position + Vector3.up * yDistance;

// transform.position = target.position + new Vector3 (0f, yDistance, 0f);

}

}