Hello!
I encountered some problem with ray collision.
I want to detect if enemy can see the player. I cast a ray from the enemy's position in the direction of the player. If the first thing that the ray hits is the player, then the enemy can see the player. I store all of the AABB's in an ArrayList(no optimizations yet, just trying to solve it, no oct-tree, nothing :P). The problem is that I check if the ray hit any object with a foreach. So, even if the enemy can see the player, the method return false, because it hit a wall first in the terms of the list. Should I sort the list somehow? Smaller X positions first, then sort by Z?
Thanks in advance!
Cheers, R