定时更新
定时检测两个平台的距离,若距离小于某个值时触发函数
# File generated by Wizard 2.9.0 on Nov 21, 2024.platform_type TANK WSF_PLATFORMicon tankmover WSF_GROUND_MOVERend_moverend_platform_typeplatform tank_red TANKposition 24:42:36.68n 121:01:27.23eside redrouteposition 24:42:36.680n 121:01:27.230e altitude 0.00 ft aglspeed 22.352 m/s label Waypoint-1position 24:42:27.710n 121:00:48.453ealtitude 0.00 ft agl label Waypoint-2position 24:42:15.430n 120:59:47.653ealtitude 0.00 ft agl label Waypoint-3position 24:42:04.213n 120:58:36.929ealtitude 0.00 ft agl label Waypoint-4position 24:41:51.923n 120:57:44.916ealtitude 0.00 ft agl label Waypoint-5position 24:41:12.493n 120:57:22.169ealtitude 0.00 ft agl label Waypoint-6position 24:40:53.822n 120:57:52.570ealtitude 0.00 ft agl label Waypoint-7position 24:41:10.909n 120:58:41.639ealtitude 0.00 ft agl end_routeend_platformplatform tank_blue TANKposition 24:41:26.923n 120:57:42.288eside blueupdate_interval 0.5 son_initializeend_on_initializescript_variablesbool flag = true;end_script_variableson_updateWsfPlatform tank_red = WsfSimulation.FindPlatform("tank_red");WsfPlatform tank_blue = WsfSimulation.FindPlatform("tank_blue");double lat_red = tank_red.Latitude();double lon_red = tank_red.Longitude();double lat_blue = tank_blue.Latitude();double lon_blue = tank_blue.Longitude();WsfGeoPoint loc = tank_blue.Location();double distance = Math.Sqrt((lat_red - lat_blue)*(lat_red - lat_blue) + (lon_red - lon_blue)*(lon_red - lon_blue));if (distance < 0.003 && flag) {writeln("In area, distance is: ", distance);flag = false;}end_on_update
end_platformevent_outputfile jacksonabad.evt
end_event_outputevent_pipefile jacksonabad.aer
end_event_pipeend_time 1 hr