Unity2014. 8. 4. 17:55


  • 사람이 GPU에게 일을 시킬 수 있는 두 번의 기회가 있다.
  • Shader는 스크립팅 작업으로 사람이 GPU에게 시키는 작업.
  • 디퓨즈: 셰이더 기본. 


Posted by 코드버무려
Unity2014. 8. 4. 17:49

  • 큐브, 캡슐, 실린더는 만들어 질 때 기본적으로 각각 Collider을 가지고 있다.
    • 부모 캐릭터( 전체 몸통) 안에 팔, 다리, 머리가 붙어 있을 경우 팔, 다리, 머리를 자식이라 한다.
    • 각 자식 큐브를 클릭하고 Inspector에서 Collider을 제거해야한다.
    • 부모 Collider과 자식 Collider간의 로직이 엉켜 원하는 결과를 얻을 수 없다.



using UnityEngine;

using System.Collections;


public class Move3 : MonoBehaviour {


public float moveSpeed = 5f;

public float turnSpeed = 180f;


CharacterController _cc;

// Use this for initialization

void Start () {

_cc = GetComponent<CharacterController> (); //CharacterController 값을 받아와라.

}

// Update is called once per frame

void Update () {

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

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


Vector3 moveDir = transform.forward * v * moveSpeed * Time.deltaTime;

moveDir += new Vector3 (0f, Physics.gravity.y * Time.deltaTime, 0f);

_cc.Move (moveDir);



transform.Rotate (0f, h * turnSpeed * Time.deltaTime, 0f);

// Local 좌표축과 글로벌 좌표가 달라서....

}

}




'Unity' 카테고리의 다른 글

오브젝트 별 특성  (0) 2014.08.05
쉐이더  (0) 2014.08.04
로컬좌표계에서 캐릭터 이동  (0) 2014.08.04
C# Input.GetAxis ("Vertical") 와 transform.Rotate()  (0) 2014.08.04
C# IInput.GetAxis ("Horizontal")와 transform.Translate()  (0) 2014.08.04
Posted by 코드버무려
Unity2014. 8. 4. 17:33

using UnityEngine;

using System.Collections;


public class Move3 : MonoBehaviour {


public float moveSpeed = 5f;

public float turnSpeed = 180f;


CharacterController _cc;

// Use this for initialization

void Start () {

_cc = GetComponent<CharacterController> (); //CharacterController 값을 받아와라.

}

// Update is called once per frame

void Update () {

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

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




//_cc.Move (new Vector3 (0f, 0f, v) * moveSpeed * Time.deltaTime);

_cc.Move (transform.forward *v * moveSpeed * Time.deltaTime);


transform.Rotate (0f, h * turnSpeed * Time.deltaTime, 0f);

// Local 좌표축과 글로벌 좌표가 달라서....

}

}




'Unity' 카테고리의 다른 글

쉐이더  (0) 2014.08.04
중력을 추가 Physics.gravity.y  (0) 2014.08.04
C# Input.GetAxis ("Vertical") 와 transform.Rotate()  (0) 2014.08.04
C# IInput.GetAxis ("Horizontal")와 transform.Translate()  (0) 2014.08.04
C# 회전  (0) 2014.08.04
Posted by 코드버무려
Unity2014. 8. 4. 16:22

using UnityEngine;

using System.Collections;


public class Move2 : MonoBehaviour {


public float moveSpeed = 5f;

public float turnSpeed = 180f;


// Use this for initialization

void Start () {

}

// Update is called once per frame

void Update () {

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

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


transform.Translate (new Vector3 (0f, 0f, v * moveSpeed * Time.deltaTime));

transform.Rotate (0f, h * turnSpeed * Time.deltaTime, 0f);

}

}

'Unity' 카테고리의 다른 글

중력을 추가 Physics.gravity.y  (0) 2014.08.04
로컬좌표계에서 캐릭터 이동  (0) 2014.08.04
C# IInput.GetAxis ("Horizontal")와 transform.Translate()  (0) 2014.08.04
C# 회전  (0) 2014.08.04
C# 이동 Input.GetAxis ("Horizontal");  (0) 2014.08.04
Posted by 코드버무려
Unity2014. 8. 4. 16:18

using UnityEngine;

using System.Collections;


public class Move2 : MonoBehaviour {


public float moveSpeed = 5f;

public float turnSpeed = 180f;


// Use this for initialization

void Start () {

}

// Update is called once per frame

void Update () {

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

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


transform.Translate (new Vector3 (0f, 0f, v * moveSpeed * Time.deltaTime));

}

}



'Unity' 카테고리의 다른 글

로컬좌표계에서 캐릭터 이동  (0) 2014.08.04
C# Input.GetAxis ("Vertical") 와 transform.Rotate()  (0) 2014.08.04
C# 회전  (0) 2014.08.04
C# 이동 Input.GetAxis ("Horizontal");  (0) 2014.08.04
C# Scrip on Unity  (0) 2014.08.04
Posted by 코드버무려