[iTween] 유도 미사일 구현 관련 내용

|

출처 :https://sites.google.com/site/changgugaebaljeongli/unity3d/geim-gineung


유도 미사일 구현 - iTween

게시자: Changgu Jeong, 2013. 4. 2. 오후 11:10

using UnityEngine;

using System.Collections;


public class Missile : MonoBehaviour {

public float missileSpeed = 5.0f;

public float missileDelay = 0f;

void Update () {

  Vector3 testVec =Camera.main.ScreenToWorldPoint(Input.mousePosition);  - 스크린 좌표를 게임내 좌표로 변경 시켜주는 부분

  testVec.z = 0f;   - 2D용으로 만드는 경우 z값은 받아오지 않는다

  iTween.LookUpdate(gameObject,iTween.Hash("looktarget",testVec,"time",20));   - 미사일이 마우스쪽을 바라 보도록 회전 시켜주는 부분

  iTween.MoveUpdate(gameObject,iTween.Hash ("position",testVec,"time",missileSpeed));  - 미사일이 마우스쪽을 향하도록 일정한 속도로 이동시켜 주는 부분


}

}



Trackback 0 And Comment 0
prev | 1 | 2 | next