• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Detecting Hills between 2 points

Status
Not open for further replies.
Level 9
Joined
Dec 21, 2006
Messages
490
hi is there any cpu friendly way to detect a hill between 2 points?

for now i do a for each "real" between 5 and distance between 2 points.

if point with offset angle distance = point 1 + "real" > ground height ...


but these are alot of points being checked and for different cases....

any way to do this different?
 
Level 9
Joined
Dec 21, 2006
Messages
490
i'll check every point between point 1 and point 2 (point with polar offset +3 ). if the checked points height is higher than (let's say all hills are higher than 20) 20 it saves that point.

@Dr what exactly do you mean with checking the squares? how would this look like?

@blue i don't get it
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Well, each tile in the game is made up of 4 points. Infact, each triangle of the terrain is made up of 3 points. Thus all you need to do is work out where these are and check if the line collides with the triangle (vector mathimatics).

This will optimize your search to be 100% accurate for a line at the least cost (only searches collision with tiles it passes over).
 
Status
Not open for further replies.
Top