stop sending velocity and acceleration in the motion information when crashed
and using speed up time to allow a fine displayed predicted position when time accelerated (no more jumping planes accelerated using the mp patch) tell me if it's not the good pace to do such things ;)
This commit is contained in:
parent
3c73a48ce2
commit
0d9091bab6
2 changed files with 25 additions and 9 deletions
|
@ -154,6 +154,7 @@ void FGAIMultiplayer::update(double dt)
|
|||
} else if (compensateLag == 1) { offset = curentPkgTime - curtime - lag;
|
||||
|
||||
// using the prediction mode to display the mpaircraft in the futur/past with given playerlag value
|
||||
//currently compensatelag = 2
|
||||
} else { offset = curentPkgTime - curtime + 0.48*lag + playerLag;
|
||||
}
|
||||
if ((!mAllowExtrapolation && offset + lag < mTimeOffset)
|
||||
|
|
|
@ -783,15 +783,30 @@ FGMultiplayMgr::SendMyPosition(const FGExternalMotionData& motionInfo)
|
|||
motionInfo.orientation.getAngleAxis(angleAxis);
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->orientation[i] = XDR_encode_float (angleAxis(i));
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->linearVel[i] = XDR_encode_float (motionInfo.linearVel(i));
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->angularVel[i] = XDR_encode_float (motionInfo.angularVel(i));
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->linearAccel[i] = XDR_encode_float (motionInfo.linearAccel(i));
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->angularAccel[i] = XDR_encode_float (motionInfo.angularAccel(i));
|
||||
|
||||
if (fgGetBool("/sim/crashed",true))
|
||||
{
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
{
|
||||
// no speed or acceleration sent when crashed, for better mp patch
|
||||
PosMsg->linearVel[i] = XDR_encode_float (0.0);
|
||||
PosMsg->angularVel[i] = XDR_encode_float (0.0);
|
||||
PosMsg->linearAccel[i] = XDR_encode_float (0.0);
|
||||
PosMsg->angularAccel[i] = XDR_encode_float (0.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//including speed up time in velocity and acceleration
|
||||
double timeAccel = fgGetDouble("/sim/speed-up");
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->linearVel[i] = XDR_encode_float (motionInfo.linearVel(i) * timeAccel);
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->angularVel[i] = XDR_encode_float (motionInfo.angularVel(i) * timeAccel);
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->linearAccel[i] = XDR_encode_float (motionInfo.linearAccel(i) * timeAccel * timeAccel);
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
PosMsg->angularAccel[i] = XDR_encode_float (motionInfo.angularAccel(i) * timeAccel * timeAccel);
|
||||
}
|
||||
xdr_data_t* ptr = msgBuf.properties();
|
||||
std::vector<FGPropertyData*>::const_iterator it;
|
||||
it = motionInfo.properties.begin();
|
||||
|
|
Loading…
Add table
Reference in a new issue