Closed MCArth closed 2 years ago
The code in getEntitiesInAABB adds worldoffset:
var testExtents = [ box.base[0] + off[0], box.base[1] + off[1], box.base[2] + off[2], box.max[0] + off[0], box.max[1] + off[1], box.max[2] + off[2], ]
instead of subtracting as should be done to correctly convert from global to local co-ordinates:
var testExtents = [ box.base[0] - off[0], box.base[1] - off[1], box.base[2] - off[2], box.max[0] - off[0], box.max[1] - off[1], box.max[2] - off[2], ]
testExtents is tested against positionComponent._extents which is in local co-ordinates, so should also be local.
Right you are, thanks very much!
The code in getEntitiesInAABB adds worldoffset:
instead of subtracting as should be done to correctly convert from global to local co-ordinates:
testExtents is tested against positionComponent._extents which is in local co-ordinates, so should also be local.