function TransformDirection (direction : Vector3) : Vector3
Description
변환 direction 지역 공간에서 전체 공간.
이 작업은 스케일이나 변환의 위치에 의해 영향을 받지 않는다 반환되는 벡터는 같은 길이를 갖는다 direction.
C#
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Transform cam = Camera.main.transform;
public Vector3 cameraRelativeRight = cam.TransformDirection(Vector3.right);
void Awake() {
rigidbody.AddForce(cameraRelativeRight * 10);
}
}
using System.Collections;
public class example : MonoBehaviour {
public Transform cam = Camera.main.transform;
public Vector3 cameraRelativeRight = cam.TransformDirection(Vector3.right);
void Awake() {
rigidbody.AddForce(cameraRelativeRight * 10);
}
}
'유니티 > 스크립트' 카테고리의 다른 글
| 특정위치 아래로 이동하는 함수 - Lerp 사용 (0) | 2014.02.17 |
|---|---|
| 캐릭터 체력 바 생성하기 (1) | 2014.02.17 |
| Transform.TransformDirection (0) | 2014.02.17 |
| 타워에서 가까운 적을 판별 하는 스크립트 (0) | 2014.02.17 |
| 적이 메인카메라 쪽 바라보게 하기 (0) | 2014.02.16 |
| 플레이어 가속도 주는 함수. (0) | 2014.02.13 |
Trackback 0 And
Comment 0


