Tag Info

New answers tagged

0

It depends on how complex you want your AI behaviors to be. If you want the most realistic, do some research on the A* algorithm. The other easier option would most likely be depth first search. Definitely look into AI pathfinding and you should find your solution.


1

As per @Krom Stern's suggestion, this is my solution to this problem. An incomplete, but working box cast algorithm for uniform grid: http://jsfiddle.net/d5ab67fj/1/. It currently is missing the end point cases and it only increment in X direction, but the algorithm itself is working. It will not miss any cells that the box would hit and it will not ...


0

Given that you cast just one ray and that objects can take no more than closest neighbor tiles in any of 8 directions, you just need to expand your resulting list of tiles 1 tile in every direction. Either while you detect the tiles rays goes through, or after you have the whole list - depends on your needs/constraints.


3

Your problem is not the ray cast, but that your grid cell doesn't reflect its actual state or in other words it might contain objects that it doesn't know about. When a certain object intersects a grid cell, the grid cell should know about it, this way when an object intersect multiple grid cells each grid cell should have a reference to that object, this ...



Top 50 recent answers are included