mirror of https://github.com/axmolengine/axmol.git
fix terrain ray trace bug when there is offset
This commit is contained in:
parent
378cfa35b6
commit
1ac82fa273
|
@ -548,7 +548,7 @@ bool Terrain::getIntersectionPoint(const Ray & ray_, Vec3 & intersectionPoint) c
|
||||||
getWorldToNodeTransform().transformPoint(&(ray._origin));
|
getWorldToNodeTransform().transformPoint(&(ray._origin));
|
||||||
|
|
||||||
std::set<Chunk *> closeList;
|
std::set<Chunk *> closeList;
|
||||||
Vec2 start = Vec2(ray._origin.x,ray._origin.z);
|
Vec2 start = Vec2(ray_._origin.x,ray_._origin.z);
|
||||||
Vec2 dir = Vec2(ray._direction.x,ray._direction.z);
|
Vec2 dir = Vec2(ray._direction.x,ray._direction.z);
|
||||||
start = convertToTerrainSpace(start);
|
start = convertToTerrainSpace(start);
|
||||||
start.x /=(_terrainData._chunkSize.width+1);
|
start.x /=(_terrainData._chunkSize.width+1);
|
||||||
|
|
Loading…
Reference in New Issue