Fix stuff
This commit is contained in:
@ -71,6 +71,7 @@ namespace RageCoop.Client{
|
|||||||
internal int _lastLivery = -1;
|
internal int _lastLivery = -1;
|
||||||
List<Vector3> _predictedTrace = new List<Vector3>();
|
List<Vector3> _predictedTrace = new List<Vector3>();
|
||||||
List<Vector3> _orgTrace = new List<Vector3>();
|
List<Vector3> _orgTrace = new List<Vector3>();
|
||||||
|
private Vector3 _predictedPosition;
|
||||||
|
|
||||||
float _elapsed;
|
float _elapsed;
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -261,20 +261,21 @@ namespace RageCoop.Client
|
|||||||
}
|
}
|
||||||
void DisplayVehicle(bool touching)
|
void DisplayVehicle(bool touching)
|
||||||
{
|
{
|
||||||
_elapsed = Owner.PacketTravelTime+0.001f*LastSyncedStopWatch.ElapsedMilliseconds;
|
_elapsed = Owner.PacketTravelTime + 0.001f * LastSyncedStopWatch.ElapsedMilliseconds;
|
||||||
Position += _elapsed*Velocity;
|
_predictedPosition = Position + _elapsed * Velocity;
|
||||||
var current = MainVehicle.ReadPosition();
|
var current = MainVehicle.ReadPosition();
|
||||||
var dist = current.DistanceTo(Position);
|
var dist = current.DistanceTo(_predictedPosition);
|
||||||
var cali = dist*(Position - current);
|
var cali = dist * (_predictedPosition - current);
|
||||||
if (Velocity.Length()<0.1) { cali*=10; }
|
if (Velocity.Length() < 0.1) { cali *= 10; }
|
||||||
if (dist>10)
|
if (dist > 10)
|
||||||
{
|
{
|
||||||
MainVehicle.Position = Position;
|
MainVehicle.Position = _predictedPosition;
|
||||||
MainVehicle.Velocity = Velocity;
|
MainVehicle.Velocity = Velocity;
|
||||||
MainVehicle.Quaternion = Quaternion;
|
MainVehicle.Quaternion = Quaternion;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MainVehicle.Velocity = Velocity+cali;
|
MainVehicle.Velocity = Velocity+cali;
|
||||||
|
|
||||||
if (IsFlipped)
|
if (IsFlipped)
|
||||||
|
Reference in New Issue
Block a user