1
This commit is contained in:
parent
fddc8015dc
commit
1d2b4a86f3
@ -889,8 +889,27 @@ bool MapInstance::SceneRaycast(const glm::vec3& orig,
|
|||||||
glm::vec3 nearest_pt(0.0f, 0.0f, 0.0f);
|
glm::vec3 nearest_pt(0.0f, 0.0f, 0.0f);
|
||||||
int raycast_index = MapMgr::Instance()->IncCurrRaycastIndex();
|
int raycast_index = MapMgr::Instance()->IncCurrRaycastIndex();
|
||||||
float len = 0.0f;
|
float len = 0.0f;
|
||||||
while (true) {
|
do {
|
||||||
|
glm::vec3 curr_pos = orig + dir * len;
|
||||||
|
len += 5.0f;
|
||||||
|
if (len > max_distance) {
|
||||||
|
len = max_distance;
|
||||||
|
curr_pos = orig + dir * len;
|
||||||
}
|
}
|
||||||
|
int grid_id = map_service_->GetGridId(curr_pos.x, curr_pos.z);
|
||||||
|
list_head* grid_list[9];
|
||||||
|
int grid_count = 0;
|
||||||
|
map_service_->GetGridList(grid_id, grid_list, grid_count);
|
||||||
|
for (int i = 0; i < grid_count; ++i){
|
||||||
|
list_head* head = grid_list[i];
|
||||||
|
if (list_empty(head)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CellNode *node, *tmp;
|
||||||
|
list_for_each_entry_safe(node, tmp, head, entry) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user