From: mfranz Date: Mon, 22 Jan 2007 23:01:39 +0000 (+0000) Subject: Maik JUSTUS: support waterplane anchor X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=197fd508486e9a5a77dc858c02d45bcc50e65d4a;p=flightgear.git Maik JUSTUS: support waterplane anchor --- diff --git a/src/FDM/YASim/Hitch.cpp b/src/FDM/YASim/Hitch.cpp index 3d4a2facf..97458f1a8 100755 --- a/src/FDM/YASim/Hitch.cpp +++ b/src/FDM/YASim/Hitch.cpp @@ -273,13 +273,9 @@ void Hitch::setWinchPositionAuto(bool doit) _node->setBoolValue("broken",false); //set the dist value (if not, the hitch would open in the next calcforce run - //float delta[3]; - //Math::sub3(lWinchPos,_pos,delta); - //_dist=Math::mag3(delta); - _dist=Math::mag3(lWinchPos); //use the aircraft center as reference for distance calculation - //this position is transferred to the MP-Aircraft. - //With this trick, both player in aerotow get the same length - + float delta[3]; + Math::sub3(lWinchPos,_pos,delta); + _dist=Math::mag3(delta); } void Hitch::findBestAIObject(bool doit,bool running_as_autoconnect) @@ -430,8 +426,10 @@ void Hitch::calcForce(Ground *g_cb, RigidBody* body, State* s) *_state=*s; s->posGlobalToLocal(_winchPos,lWinchPos); Math::sub3(lWinchPos,_pos,delta); - //_dist=Math::mag3(delta); - _dist=Math::mag3(lWinchPos); //use the aircraft center as reference for distance calculation + if(!_towEndIsConnectedToProperty) + _dist=Math::mag3(delta); + else + _dist=Math::mag3(lWinchPos); //use the aircraft center as reference for distance calculation //this position is transferred to the MP-Aircraft. //With this trick, both player in aerotow get the same length Math::unit3(delta,deltaN);