![]() |
Terrain height at map point2D ?
I want to develop a function that recieves a 2D map coordinate & returns the terrain height at that point. Height could be a Z coordinate or height in metres. I've searched the COD methods for something useful I can play with without success. Any ideas anyone?
code removed by author |
I use something similar in my develpment I am working on, where I use a trigger point reference to activate the process, then within the Ontrigger I use the 2D pos location realtive to the trigger location. I only needed the 2D at this point, but was thinking about 3D aswell
There is 3D like the 2D which contains the z axis. If you use the visual express you can load the specific clod syntax. |
Quote:
There is 3D like the 2D which contains the z axis." Can you explain what methods or formula or algorithm you are using the obtain terrain height from the 2D map point. |
example
here are two codes to help
sorry no time to explain Code:
Code:
private bool PointBetween(double intervalPoint1,double intervalPoint2,double point) // kh-n checks whether the point lies in the interval |
I get most of that Wolf, but I still don't see how this determines terrain height at the marker point? I was hoping I could find a method to test the LandType in 3D space, not just 2D space as below ...
code removed by author |
Much as wolf describes, although it looks like his version adds math function.
Kodiak helped me with the syntax arrangement for the 2Dpoint stuff, the rest I added, the logic test. This is part of the complete code, I call references to process the results. This setup is to detect players with a zone, well in this case 3 trigger zones where I create reaction ranges. You could just have one ofcurse. Effectively this overides all internal mission parameters, except I hijack the ontrigger and trigger, where I use Tpassthough to separate the armies. For 3D, although I haven't tested it yet, I suspect all that needs to be added is the z axis to the internal double getdistancefromto. Point2 would become Point3D. That's all for the from ~ to Note the Ontrigger fires the list for players, if you had specific objects, vehicles, you could(should) list them.(better to do this as objects can disappear causing exceptions references) After the listing of the objects(players in this case) a ForEach is used to test the position against the reference The change for the 2nd part, note the redradarx and redradar1y are the grid reference x,y coords. You would need to add the z coord Point2d RedRadar1 = new Point2d(redradar1x, redradar1y); //this is reference location. Point2d ActorPos = new Point2d(item.Place().Pos().x, item.Place().Pos().y);// this is object location at time of trigger Theory, would become Point3d <name> = new Point3d(coord x, coord y, coord z); Point3d ActorPos = new Point3d(item.Place().Pos().x, item.Place().Pos().y, item.Place().Pos().z); I use ranging tests in the logic following the location tests, you wouldn't need all this, only one test, less than the distance you want to trigger from the (x,y,z) reference position. In my test if the result is true for any of the states, note I set different true or false arrangements, this is processsesd in the final mission loader private void. I also separate the ai trigger processing into separate private void. The advantage of separating final processing is that I can activate the final processing by other conditions other than ontrigger. Code:
|
All times are GMT. The time now is 03:09 PM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.