xs_plane_rayintersect
- Синтаксис
-
stock bool:xs_plane_rayintersect(const Float:plane[], const Float:rayStart[], const Float:rayDir[], Float:out[]) { new Float:a = xs_vec_dot(plane, rayDir); if (a == 0.0) return false; // ray is parallel to plane // if (distance plane<->(rayStart + rayDir) > distance plane<->rayStart) and both have the same sign, the ray // goes away from the plane new Float:rsplusrd[3]; xs_vec_add(rayStart, rayDir, rsplusrd); new Float:dst1 = xs_plane_dst2point(plane, rsplusrd); new Float:dst2 = xs_plane_dst2point(plane, rayStart); if (xs_fabs(dst1) > xs_fabs(dst2) && xs_fsign(dst1) == xs_fsign(dst2)) return false; // out = rayStart - rayDir * ((distance plane<->rayStart) / a) new Float:__tmp[3]; xs_vec_mul_scalar(rayDir, xs_plane_dst2point(plane, rayStart) / a, __tmp); // out = rayStart - tmp xs_vec_sub(rayStart, __tmp, out); return true; }
Переменная | Описание |
---|---|
Нет агрументов |
- Описание
- This function has no description.