Game Development Community

Best way to display a firing arc / line of sight?

by Matt Grosse · in Torque Game Builder · 05/16/2007 (4:21 pm) · 0 replies

Hey guys, i'm working on a top-down game and i'd like to draw out an arc for the player. so if the right firing arc is 45 degress, i'd like to extend the arc from the center of the player sprite out to the max range of the weapon and highlight the entire valid firing area. the degree of the arc will most likely be fixed at 45 degrees, but the ranges will definitely vary by weapon/class etc. is it possible to just "draw" the arc dynamically, or would i need to use a sprite and scale it to fit my needs?

also is there a way (similar to say a TGE raycast) to determine line of sight in TGB? like if i wanted to check for obstacles before allowing the unit to fire, or just take it into consideration when determining whether or not they actually hit the target. i'm guessing i could determine the path from the source object to the target, then "walk" along it and pick points along the way - tracking whether or not i come across an obstacle sprite.

thanks for any help!