0
실시간 충돌 탐지 북은 다음 방정식을가집니다.ObjectiveC의 컴퓨팅 교차점
// Compute the t value for the directed line ab intersecting the plane
Vector ab = b - a;
t = (p.d - Dot(p.n, a))/Dot(p.n, ab);
그래서 내가 가진 내가 float로서 t을 필요로 현재
GLKVector3 abD = GLKVector3Subtract(b, a);
GLKVector3 planeD = GLKVector3Make(1.0f, 0.0f, 1.0f);
GLKVector3 planeN = GLKVector3Make(0.0f, 1.0f, 0.0f);
//t = (p.d - Dot(p.n, a))/Dot(p.n, ab);
float dotPbA = GLKVector3DotProduct(planeN, a);
float dotPbAbD = GLKVector3DotProduct(planeN, abD);
GLKVector3 nominator = GLKVector3SubtractScalar(planeD, dotPbA);
GLKVector3 t = GLKVector3DivideScalar(nom, dotPbAbD);
// float t = nominator/dotPbA
로 그. 나는 무엇을해야합니까? 나는 glm 또는 그와 같은 것이 작동 자만 사용한다는 것을 알고 있습니다.
GLKVector3의 길이가 내가 필요한 것을 줄 수 있습니까?
계산할 수 있습니다. – Andrew
그 코드는 실행되지만, 0 일 때 1의 값을 얻지 못합니다. – Andrew
@Andrew : 입력 데이터가 무엇입니까? 수식이 맞는 것 같습니다. –