Skip to main content
GameDev.net gamedev.net
🔒 Locked

"Gridless" Targeting

Started by Daikessen Jan 21, 2008 at 7:49 PM 2 replies 750+ views
Original Post
Daikessen
Daikessen
Hello, just looking for the math behind gridless targeting systems for Strategy RPGS, Phantom Brave Specifically. the only part I'm having toruble with explicitly is selecting all of something inside a set perimeter, say a 6 sided polygon that serves as the area of effect for a spell. it expands depending on the spell and such. still trying to get my head around it, I'd really appreciate help with this.
Striken
Striken
Just a thought -

Could you subdivide the polygon up into individual triangle segments and test point-in-triangle for each of them?
Teach a programmer an answer, he can code for a day. Show a programmer the documentation, he can code for a lifetime.
Ezbez
Ezbez
Unless you really need hexagonal spells, use a circle instead. Testing whether a point is inside a circle is dead simple. (Take distance from point to center of circle. Is that less than the radius of the circle?)
OrangyTang
OrangyTang
If your selection poly is always convex (which is reasonably likely) then a point-in-convex-hull test is reasonably simple. You simply test the point against the line made by each edge and check that the point lies "inside" all of the lines. Google can tell you more.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.