Game Development Community

Generating grid around player

by N.K. · in Torque Game Engine · 03/11/2009 (12:42 pm) · 0 replies

Hi,
I've been wanting to generate a grid (2d array) for a player that represents the immediate surrounding of the player. For example, for a grid of size 9, element [4_4] represents the player; if there is an opponent in front of the player then [3_4] would have an 'o' or something like that.

What I want to know is what is the fastest method of generating the grid. I can use containerRayCast() and cast a ray in the centre of each grid position but I was wondering if there is any quicker, less computationally intensive way of doing it.

I'm not using container radius search since it only doesn't help if some large object, say an interior, takes more than one square on the grid.

Thanks