|
Post by Ispanets on Jan 9, 2016 21:39:45 GMT
Hi!
I was trying to figure out how to create rivers in fixed positions of the map, instead of randomizing them. Unfortunately, I get completely lost when trying to understand the code. Can you please tell me if given, for example, a set of N hexes (x,y), if it's an easy way to paint a river?
Thanks in advance.
Jose
|
|
|
Post by khash on Jan 10, 2016 0:19:55 GMT
For rivers you need to understand that you do not paint rivers across the hexes, instead they are linking hex corners, and each hex corner have always 3 hex neighbours and can lead into one of the 3 directions.
so understanding that hex positions are like: (0,0,0) (1,0,-1) etc river points are like
Corners around (0,0,0) are like: (0.5, -0.5, -0.5) (-0.5, 0.5, -0.5) (-0.5, -0.5, 0.5) (-0.5, 0.5, 0.5) (0.5, -0.5, 0.5) (0.5, 0.5, -0.5)
They are off from zero by 0.5
Does it help?
|
|
|
Post by ispanets on Jan 10, 2016 10:14:02 GMT
Hi, khash!
Thank you very much for your quick response. So the steps are:
1) I set the river start (hex + calculations of the corner). For example, RiverData startPoint = new RiverData(fPos) (where fPos is the hex coord already modificated to be a corner); 2) I set the next point (that is, another corner):
Vector3 nexPoint = new Vector3(-0.5f, 0.5f, -0.5f) RiverData newWalker = new RiverData(walker.position + nexPoint); walker.SetNext(newWalker); prevWalker = walker; walker = newWalker;
And then, how do I draw the river from the startPoint to the next one?
Thanks again,
Jose
|
|
|
Post by ispanets on Jan 10, 2016 19:01:31 GMT
Khash, I have already figured it out. Thank you very much!
|
|
|
Post by khash on Jan 11, 2016 1:23:29 GMT
Hi! Great. Sorry, forum gives very lazy info when someone writes on it. I just get ping and its 15 hours after your question. So its great you get it working
|
|