Allow more complex collision checking
Posted: Thu May 12, 2016 9:38 pm
As for now there is only one function to check the expected collision of some entity, which is going to appear on a map in some position, with other entities already existing on this map. It is a LuaSurface.can_place_entity() method.
My suggestion is to provide more flexible collision checking. As vehicles (which are among the most freely moving entities in the game) seem to check their collisions using rotated collision boxes, I assume that such check is more or less optimized on C++ side. And I hope that there is possibility to provide this check to the Lua API.
The function may take in a rectangle, an orientation (0..1 as for vehicles) and a collision mask of the layers to check collision with and return a boolean result indicating whether there is collision or not.
My suggestion is to provide more flexible collision checking. As vehicles (which are among the most freely moving entities in the game) seem to check their collisions using rotated collision boxes, I assume that such check is more or less optimized on C++ side. And I hope that there is possibility to provide this check to the Lua API.
The function may take in a rectangle, an orientation (0..1 as for vehicles) and a collision mask of the layers to check collision with and return a boolean result indicating whether there is collision or not.