Vector3.Dot

Unity3D 2015. 1. 15. 21:02
반응형


// detects if other transform is behind this object

var other : Transform; function Update() { if (other) { var forward = transform.TransformDirection(Vector3.forward); var toOther = other.position - transform.position; if (Vector3.Dot(forward,toOther) < 0) print ("The other transform is behind me!"); } }

를 노멀라이즈한다.이는 그들이 정확하게 같은 방향으로 시점 경우 벡터 다트는 1을 반환하기 위함이다; -1 그들은 완전히 반대 방향으로 가려면, 다른 사이에 숫자 케이스 (다트 반환 예 : 벡터가 수직하는 경우 제로).


두 백터의 닷프러덕트.


http://ko.m.wikipedia.org/wiki/%EC%8A%A4%EC%B9%BC%EB%9D%BC%EA%B3%B1

수학에서, 스칼라곱(scalar곱, 영어: scalar product) 또는 점곱(영어: dot product)은 두 벡터 스칼라를 계산하는 이항연산이다. 스칼라곱을 사용하는 모든 유클리드 공간 내적공간이므로, 스칼라곱을 단순히 ‘내적’이라 부르기도 한다.

반응형
: