레거시 방식과 메카님 방식의 차이



레거시 : 3D MAX와 같은 툴에서 에니메이션을 각 오브젝트마다 가지고 오는 방식

메카님 : 2족 보행, 4족 보행등 다른 오브젝트의 에니메이션을 이식해 올 수 있는 방식을 말한다.



prepab 복사 ->휴머노이드로 변경

prepab 하나더 복사해서 에니메이션을 제거하고 에니메이트 컨트롤러를 생성해주는것


위에 있는 muktargame 삭제 -> 복사본을 오브젝트에 올리고 apply root motion 체크 해제


-->create -> Animator Controller -> 더블클릭 -> 위에 에니메이션을 드롭엔 다운

defalt motion 설정


monster mecanim 에 monsterCTrl 삽입

'유니티3D > 예제' 카테고리의 다른 글

PaddleGame  (0) 2013.08.15
MonsterCtrl.cs  (0) 2013.08.12
BulletCtrl.cs  (0) 2013.08.07
miniMap  (0) 2013.08.07
PlayerCtrl  (0) 2013.08.06

using UnityEngine;

using System.Collections;


public class Spark : MonoBehaviour {


public GameObject firstSpark;   

public GameObject secondSpark;

public AudioClip firstSound;

public AudioClip secondSound;

private int hit = 0;

void OnCollisionEnter(Collision Col)

{

if(Col.gameObject.tag == "Bullet")

{

hit++;

audio.PlayOneShot(firstSound, 1.0f);

GameObject newSpark1 = (GameObject)Instantiate(firstSpark, Col.transform.position, Quaternion.LookRotation(-Col.transform.position));

Destroy(newSpark1, 3.0f);

Destroy(Col.gameObject);

if(hit >=3)

{

GetComponent<CapsuleCollider>().enabled = false;

Explosion();

}

}

}

void Explosion()

{

audio.PlayOneShot(secondSound, 1.0f);

gameObject.AddComponent<Rigidbody>();

GameObject newSpark2 = (GameObject)Instantiate (secondSpark,transform.position,Quaternion.identity);

GetComponent<Rigidbody>().AddForce(Vector3.up * 1000.0f);

Destroy(newSpark2,5.0f);

Destroy(gameObject,0.2f);

}

}


'유니티3D > 예제' 카테고리의 다른 글

MonsterCtrl.cs  (0) 2013.08.12
메카님방식  (0) 2013.08.12
miniMap  (0) 2013.08.07
PlayerCtrl  (0) 2013.08.06
Bullet  (0) 2013.08.06

http://cafe.naver.com/xgdn/5043

'유니티3D > 예제' 카테고리의 다른 글

메카님방식  (0) 2013.08.12
BulletCtrl.cs  (0) 2013.08.07
PlayerCtrl  (0) 2013.08.06
Bullet  (0) 2013.08.06
MyGizmo.cs  (0) 2013.08.06

using UnityEngine;

using System.Collections;


public class PlayCtrl : MonoBehaviour {

[System.Serializable]   //it makes that i can use c#

public class Anim

{

public AnimationClip Idle;

public AnimationClip runForward;

public AnimationClip runBackward;

public AnimationClip runRight;

public AnimationClip runLeft;

}


public Anim anim;

public Animation aniBody;

public float Speed = 10.0f;

public GameObject BulletPrefab;

public Transform firepos;     //i can Input other objects.


// Use this for initialization

void Start () 

{

aniBody.clip = anim.Idle;

aniBody.Play();

}

// Update is called once per frame

void Update () {

float h = Input.GetAxis("Horizontal");

float v = Input.GetAxis("Vertical");

transform.Translate(Vector3.right * h * Speed * Time.deltaTime);

transform.Translate(Vector3.forward * v * Speed * Time.smoothDeltaTime);  // i need to cheak!

if(h > 0.1f)

{

aniBody.CrossFade(anim.runRight.name,0.3f);

    }

else if(h < -0.1f)

{

aniBody.CrossFade(anim.runLeft.name,0.3f);

    }

else if(v > 0.1f)

{

aniBody.CrossFade(anim.runForward.name,0.3f);

    }

else if(v < -0.1f)

{

aniBody.CrossFade(anim.runBackward.name,0.3f);

    }

else{

aniBody.CrossFade(anim.Idle.name,0.3f);

}

// if(Input.GetMouseButtonDown(0))  --> when I click Left mouse

if(Input.GetMouseButtonDown(0))

{

StartCoroutine("Fire");    //method name is Fire~ ~!! it's just name.

//multi Thread

}

}

IEnumerator Fire()   //if return type is IEnumerator.. this method is multi thread..

{

GameObject newBullet = (GameObject)Instantiate(BulletPrefab,firepos.position,Quaternion.identity);

//Quaternion.Euler(x,y,z);    rotation...

Destroy(newBullet, 3.0f);      //after i fired bullet..

yield return null;

}

}


'유니티3D > 예제' 카테고리의 다른 글

BulletCtrl.cs  (0) 2013.08.07
miniMap  (0) 2013.08.07
Bullet  (0) 2013.08.06
MyGizmo.cs  (0) 2013.08.06
Spark.cs  (0) 2013.08.06

+ Recent posts