Unity2014. 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);

}

}




'Unity' 카테고리의 다른 글

Ray 쏘아 오브젝트 삭제  (0) 2014.08.06
유니티 물체 배치  (0) 2014.08.06
Trail Renderer  (0) 2014.08.06
Build 설정 및 실행  (0) 2014.08.06
Rail에서 카메라 이동  (0) 2014.08.05
Posted by 코드버무려