Jump to content

Recommended Posts

Posted

Hi, in another thread (MIST) I posted this:

 

In a script that I'm using, the routing functions are used to move ground groups from point to point.

 

I check the meteo conditions (rain) to determinee if is more suitable having road enabled or disabled and for alter movement speed.

 

I found that your mist.terrainHeightDiff function could also be used to define "not suitable" the automatic routing outside road if too much height difference is found between starting and ending point. Sadly, as routes may vary from 6 to 20 km long in my script, the range could be too large for a good estimate in mixed terrain.

 

Do you think it's possibile to execute the function every 50 meters with a range of 200 mt over a straght line between starting VEC3 point and destination VEC3 point?

 

How may I setup such think?

 

Thanks in advance for those who can help :)

 

Grimes kindly answer me saying that I may use land.profile(Vec3 from, Vec3 to) instead of a more complex solution. Therefore, I could also use the simplier land.getHeight(Vec2 point) and some math to obtain this difference in height that I want.

 

Eventually, what I would like to get is to make my group "choose" if using road is a better solution due to terrain steep condition in the area from the starting point to the destination point.

 

I have an idea about using the land.getHeight, with a better efficiency than previous solution, but... how can I use the land.profile thing? i don't exactly understand it.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

land.profile returns a table of points between the two vec3 points passed. You'll have to iterate through the table to get the height difference between the points to see if it is ever greater than your on road threshold. The thing about land.profile() is I'm not sure the interval between points is always the same.

 

points = 
{
   [1] = 
   {
       ["y"] = 364.3430480957,
       ["x"] = -232651.359375,
       ["z"] = 630468,
   }, -- end of [1]
   [2] = 
   {
       ["y"] = 363.97680664063,
       ["x"] = -232661.1875,
       ["z"] = 630475.75,
   }, -- end of [2]
   [3] = 
   {
       ["y"] = 359.48217773438,
       ["x"] = -232717.015625,
       ["z"] = 630519.875,
   }, -- end of [3]
   [4] = 
   {
       ["y"] = 312.74697875977,
       ["x"] = -232953.28125,
       ["z"] = 630706.5625,
   }, -- end of [4]
   [0] = 
   {
       ["y"] = 367.01962280273,
       ["x"] = -232628.578125,
       ["z"] = 630450,
   }, -- end of [0]
} -- end of points

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

Well if the interval is determined by every slope change, it could be even better than my solution, cause I may calculate the effective slope change and use that as a threshold.

 

Maybe, do you know what is the threshold used by inbuild code that lead to a change in a linear line route (when the AI do not follow a straigh line but adapt to a different shape due to terrain limitations)?

 

Thanks a lot :)

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

Can't get the wanted result....

 

	local VectorTable = {}
	VectorTable = land.profile(InitPos, EndPos)
	
	--## DEBUG: esplicita la tabella vettori
	if DEBUGmode == true then
		local fName = "DGWS-DEBUG-Vectortable_".. GroupName .. ".csv"
		local f = io.open(lfs.writedir() .. subdirectory .. "Report/" .. fName, "w")
		local debugOBJ = ""
		
		for VectorId,VectorData in pairs(VectorTable) do	
			debugOBJ = debugOBJ .. GroupName .. tss .. VectorData.y .. tss .. VectorData.x .. tss .. VectorData.z .. "\n"
			
		end
		f:write(debugOBJ)
		f:close()		
	end

 

(GroupName, InitPos, EndPos are related to code that is before those lines. tss is ";")

 

I got a single line with those values:

 

429-APC-Btn2-Plt #006;88392158508301;0;0

 

strange...

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...