This commit is contained in:
aozhiwei 2023-01-11 18:59:48 +08:00
parent a1cf45e9e3
commit f6a945d6a8
2 changed files with 33 additions and 0 deletions

View File

@ -9,6 +9,13 @@ Position BornPoint::RandPoint() const
pos.x = 5120.000000000000;
pos.y = 6.250846862793;
pos.z = 5120.000000000000;
#if 0
pos.x = 569.797668 * 10;
pos.y = 7.7130332;
pos.z = 622.297668 * 10;
#endif
#else
pos.x = 1219.634277343750;
pos.z = 1549.267578125000;

View File

@ -346,6 +346,16 @@ bool MapInstance::Raycast(int layer, const glm::vec3& start, const glm::vec3& en
epos[1] = end.y;
epos[2] = end.z;
#if 0
spos[0] = 569.797668;
spos[1] = 7.7130332;
spos[2] = 622.297668;
epos[0] = 610.816589;
epos[1] = 7.7130332;
epos[2] = 650.888733;
#endif
const float extents[3] = {2.f, 4.f, 2.f};
float nearestPt[3];
@ -426,6 +436,22 @@ bool MapInstance::Raycast(int layer, const glm::vec3& start, const glm::vec3& en
//需要处理spos == epos的情况!!!!
// Hit
dtVlerp(hit_pos_, spos, epos, t);
#if 0
a8::XPrintf("pos1:%f,%f,%f pos2:%f,%f,%f\n",
{
spos[0],
spos[1],
spos[2],
hit_pos_[0],
hit_pos_[1],
hit_pos_[2],
});
#endif
if (std::fabs(hit_pos_[0] - spos[0]) < 0.01f &&
std::fabs(hit_pos_[2] - spos[2]) < 0.01f) {
return false;
}
if (npolys > 0) {
glm::vec3 dir(epos[0] - spos[0], epos[1] - spos[1], epos[2] - spos[2]);
GlmHelper::Normalize(dir);