Maik JUSTUS: connect fix
This commit is contained in:
parent
2af373e13a
commit
e71d997c82
1 changed files with 11 additions and 7 deletions
|
@ -60,7 +60,6 @@ Hitch::Hitch(const char *name)
|
||||||
_mp_open_last_state=false;
|
_mp_open_last_state=false;
|
||||||
_timeLagCorrectedDist=0;
|
_timeLagCorrectedDist=0;
|
||||||
|
|
||||||
//tie the properties
|
|
||||||
_node->tie("tow/length",SGRawValuePointer<float>(&_towLength));
|
_node->tie("tow/length",SGRawValuePointer<float>(&_towLength));
|
||||||
_node->tie("tow/elastic-constant",SGRawValuePointer<float>(&_towElasticConstant));
|
_node->tie("tow/elastic-constant",SGRawValuePointer<float>(&_towElasticConstant));
|
||||||
_node->tie("tow/weight-per-m-kg-m",SGRawValuePointer<float>(&_towWeightPerM));
|
_node->tie("tow/weight-per-m-kg-m",SGRawValuePointer<float>(&_towWeightPerM));
|
||||||
|
@ -288,14 +287,19 @@ void Hitch::findBestAIObject(bool doit,bool running_as_autoconnect)
|
||||||
static bool lastState=false;
|
static bool lastState=false;
|
||||||
if(!_state)
|
if(!_state)
|
||||||
return;
|
return;
|
||||||
if (!doit)
|
if (!running_as_autoconnect)
|
||||||
{
|
{
|
||||||
lastState=false;
|
//if this function is binded to an input, it will be called every frame as long as the key is pressed.
|
||||||
return;
|
//therefore wait for a key-release before running it again.
|
||||||
|
if (!doit)
|
||||||
|
{
|
||||||
|
lastState=false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(lastState)
|
||||||
|
return;
|
||||||
|
lastState=true;
|
||||||
}
|
}
|
||||||
if(lastState)
|
|
||||||
return;
|
|
||||||
lastState=true;
|
|
||||||
double gpos[3];
|
double gpos[3];
|
||||||
_state->posLocalToGlobal(_pos,gpos);
|
_state->posLocalToGlobal(_pos,gpos);
|
||||||
double bestdist=_towLength*_towLength;//squared!
|
double bestdist=_towLength*_towLength;//squared!
|
||||||
|
|
Loading…
Reference in a new issue