Le 25/01/2011 21:07, Peter Brown a écrit :

On Jan 25, 2011, at 2:55 PM, Vivian Meazza wrote:

Is there a problem with maintaining vertical sync with MPCarrier? If there is please file a report here:

http://code.google.com/p/flightgear-bugs/issues/list

Vivian



No Vivian,

Curt suggested that "carriers do a terrain height check and follow the polygon curvature of the FlightGear world". Not knowing if there was something in place to maintain sync with vertical change, I commented that that would be a great idea if possible.

Peter

hi, here's a diff to have the mp carrier follow the sea level , if you find something usefull in it. I didn't test it recently against the "tsunami" crossing the sea, but was working months ago.

jano


diff --git a/Aircraft/MPCarrier/Systems/commander.nas b/Aircraft/MPCarrier/Systems/commander.nas
index 1a85867..f49f5c5 100644
--- a/Aircraft/MPCarrier/Systems/commander.nas
+++ b/Aircraft/MPCarrier/Systems/commander.nas
@@ -31,6 +31,7 @@ var c_control_rudder  = "surface-positions/rudder-pos-deg";
 var c_control_mp_ctrl = "controls/mp-control";
 var c_control_radius  = "controls/turn-radius-ft";
 
+var index = 0;
 
 # Player constants
 var p_lat     = "/position/latitude-deg";
@@ -168,6 +169,24 @@ var toggleAIControl = func {
   }
   gui.popupTip(((AI_control) ? "AI" : "Manual") ~ " control.")
 }
+###########################################################################
+var ground_contact = func {
+  # set speed to 0 if near #####
+  if (getprop("/ai/models/carrier[" ~ index ~ "]/controls/base-speed-kts") == 0) {
+    if (getprop("/ai/models/carrier[" ~ index ~ "]/velocities/speed-kts") < 0.2) {
+      interpolate("/ai/models/carrier[" ~ index ~ "]/velocities/speed-kts",0,5)
+    }
+  };
+  # try to keep the boat on the sea #####
+  # be sure to have a wake non solid or the boat will climb to the moon :) ####
+  # the test point is supposed to be above the "tsunami" hight, but long time not tested ####
+
+  var geo_coord = geo.aircraft_position().apply_course_distance((carrier_base.getNode(c_heading).getValue()+75), 50);
+  var info = geodinfo(geo_coord.lat(),geo_coord.lon());
+  var time = 10;
+  interpolate("/ai/models/carrier[" ~ index ~ "]/position/altitude-ft",(info[0]*M2FT +2),time);
+  settimer(ground_contact,time);
+}
 
 ###########################################################################
 var init = func {
@@ -187,6 +206,9 @@ var init = func {
                     "MPCarriersNW");
       MPCarriersNW.mp_network_init(1);
 
+      settimer(ground_contact,200); # get error if the water is not present when first check, 
+                                    # wich some time take times...
+
       # Make sure the current speed and course will be transmitted.
       setprop(p_control_speed,
               carrier_base.getNode(c_control_speed).getValue());
@@ -208,6 +230,8 @@ var init = func {
       p = "controls/tgt-speed-kts";
       props.globals.getNode(p, 1).alias(carrier_base.getNode(p));
 
+      index = carrier_base.getNode("id").getValue() - 1;
+
       # Avoid ugly error messages if the current carrier doesn't
       # have a walk view.
       if (!contains(globals, "walkview")) {
diff --git a/Models/Geometry/Nimitz/eisenhower.xml b/Models/Geometry/Nimitz/eisenhower.xml
index a625091..3bffac9 100644
--- a/Models/Geometry/Nimitz/eisenhower.xml
+++ b/Models/Geometry/Nimitz/eisenhower.xml
@@ -338,6 +338,7 @@ apart from most of the very excellent textures, remain. -->
 			<y>0</y>
 			<z>-1</z>
 		</axis>
+                <enable-hot type="bool">false</enable-hot>
 	</animation>
 	<animation>
 		<type>translate</type>
diff --git a/Models/Geometry/Nimitz/nimitz.xml b/Models/Geometry/Nimitz/nimitz.xml
index db63b2f..c70e950 100644
--- a/Models/Geometry/Nimitz/nimitz.xml
+++ b/Models/Geometry/Nimitz/nimitz.xml
@@ -361,6 +361,7 @@ apart from most of the very excellent textures, remain. -->
 			<y>0</y>
 			<z>-1</z>
 		</axis>
+                <enable-hot type="bool">false</enable-hot>
 	</animation>
 
 	<animation>
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to