mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 17:39:46 +00:00
fix block positions rounded to float in ray casts and routes
iendpoint of block.raycast, entities.raycast and world.raycast and nodes of a pathfinding route are integer block positions, but they were pushed to Lua through glm::vec3. An odd coordinate above 16.7M came back as a neighbour block.
This commit is contained in:
parent
56ab3de514
commit
ebd506de09
3 changed files with 3 additions and 3 deletions
|
|
@ -598,7 +598,7 @@ static int l_raycast(lua::State* L) {
|
|||
lua::pushnumber(L, glm::distance(start, end));
|
||||
lua::setfield(L, "length");
|
||||
|
||||
lua::pushvec3(L, iend);
|
||||
lua::pushvec(L, iend);
|
||||
lua::setfield(L, "iendpoint");
|
||||
|
||||
lua::pushinteger(L, voxel->id);
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ static int l_push_ray(
|
|||
lua::pushnumber(L, ray ? ray->distance : glm::distance(start, end));
|
||||
lua::setfield(L, "length");
|
||||
|
||||
lua::pushvec3(L, iend);
|
||||
lua::pushvec(L, iend);
|
||||
lua::setfield(L, "iendpoint");
|
||||
|
||||
lua::pushinteger(L, block);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static int l_is_enabled(lua::State* L) {
|
|||
static int push_route(lua::State* L, const voxels::Route& route) {
|
||||
lua::createtable(L, route.nodes.size(), 1);
|
||||
for (int i = 0; i < route.nodes.size(); i++) {
|
||||
lua::pushvec3(L, route.nodes[i].pos);
|
||||
lua::pushvec(L, route.nodes[i].pos);
|
||||
lua::rawseti(L, i + 1);
|
||||
}
|
||||
lua::pushinteger(L, route.totalVisited);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue