Back to old rotation calculation.
This commit is contained in:
parent
88a51cc154
commit
11d178498f
@ -358,7 +358,7 @@ namespace RageCoop.Client
|
||||
if (v.IsMine) { return; }
|
||||
v.ID= packet.ID;
|
||||
v.Position=packet.Position;
|
||||
v.Rotation=packet.Rotation;
|
||||
v.Quaternion=packet.Quaternion;
|
||||
v.SteeringAngle=packet.SteeringAngle;
|
||||
v.ThrottlePower=packet.ThrottlePower;
|
||||
v.BrakePower=packet.BrakePower;
|
||||
|
@ -77,7 +77,8 @@ namespace RageCoop.Client
|
||||
ID =v.ID,
|
||||
SteeringAngle = veh.SteeringAngle,
|
||||
Position = veh.PredictPosition(),
|
||||
Rotation = veh.Rotation,
|
||||
Quaternion=veh.Quaternion,
|
||||
// Rotation = veh.Rotation,
|
||||
Velocity = veh.Velocity,
|
||||
RotationVelocity=veh.RotationVelocity,
|
||||
ThrottlePower = veh.ThrottlePower,
|
||||
|
@ -56,6 +56,7 @@ namespace RageCoop.Client
|
||||
|
||||
public Vector3 Position { get; set; }
|
||||
public Vector3 Rotation { get; set; }
|
||||
public Quaternion Quaternion { get; set; }
|
||||
public Vector3 Velocity { get; set; }
|
||||
public abstract void Update();
|
||||
public void PauseUpdate(ulong frames)
|
||||
|
@ -52,7 +52,6 @@ namespace RageCoop.Client
|
||||
#region LAST STATE STORE
|
||||
|
||||
|
||||
private ulong _vehicleStopTime { get; set; }
|
||||
private byte[] _lastVehicleColors = new byte[] { 0, 0 };
|
||||
private Dictionary<int, int> _lastVehicleMods = new Dictionary<int, int>();
|
||||
private byte _lastRadioIndex=255;
|
||||
@ -63,6 +62,7 @@ namespace RageCoop.Client
|
||||
public float SteeringAngle { get; set; }
|
||||
public float ThrottlePower { get; set; }
|
||||
public float BrakePower { get; set; }
|
||||
public float DeluxoWingRatio { get; set; } = -1;
|
||||
#endregion
|
||||
|
||||
#region -- VEHICLE STATE --
|
||||
@ -89,7 +89,6 @@ namespace RageCoop.Client
|
||||
/// VehicleSeat,PedID
|
||||
/// </summary>
|
||||
public Dictionary<VehicleSeat, SyncedPed> Passengers { get; set; }
|
||||
public float DeluxoWingRatio { get; set; } = -1;
|
||||
public byte RadioStation = 255;
|
||||
private long _lastPositionCalibrated { get; set; }
|
||||
|
||||
@ -137,16 +136,9 @@ namespace RageCoop.Client
|
||||
MainVehicle.Position=Position;
|
||||
MainVehicle.Velocity=Velocity;
|
||||
}
|
||||
Vector3 r = GetCalibrationRotation();
|
||||
if (r.Length() < 20f)
|
||||
{
|
||||
MainVehicle.RotationVelocity = r * 0.15f + RotationVelocity;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainVehicle.Rotation = Rotation;
|
||||
MainVehicle.RotationVelocity = RotationVelocity;
|
||||
}
|
||||
// Vector3 r = GetCalibrationRotation();
|
||||
MainVehicle.Quaternion=Quaternion.Slerp(MainVehicle.Quaternion, Quaternion, 0.35f);
|
||||
MainVehicle.RotationVelocity = RotationVelocity;
|
||||
if (DeluxoWingRatio!=-1)
|
||||
{
|
||||
MainVehicle.SetDeluxoWingRatio(DeluxoWingRatio);
|
||||
@ -330,6 +322,8 @@ namespace RageCoop.Client
|
||||
}
|
||||
private Vector3 GetCalibrationRotation()
|
||||
{
|
||||
return (Quaternion-MainVehicle.Quaternion).ToEulerAngles().ToDegree();
|
||||
/*
|
||||
var r = Rotation-MainVehicle.Rotation;
|
||||
if (r.X>180) { r.X=r.X-360; }
|
||||
else if(r.X<-180) { r.X=360+r.X; }
|
||||
@ -340,6 +334,7 @@ namespace RageCoop.Client
|
||||
if (r.Z>180) { r.Z=r.Z-360; }
|
||||
else if (r.Z<-180) { r.Z=360+r.Z; }
|
||||
return r;
|
||||
*/
|
||||
}
|
||||
private void CreateVehicle()
|
||||
{
|
||||
@ -355,7 +350,7 @@ namespace RageCoop.Client
|
||||
{
|
||||
EntityPool.Add( this);
|
||||
}
|
||||
MainVehicle.Rotation = Rotation;
|
||||
MainVehicle.Quaternion = Quaternion;
|
||||
|
||||
if (MainVehicle.HasRoof)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ namespace RageCoop.Core
|
||||
Z = ReadFloat()
|
||||
};
|
||||
}
|
||||
public Quaternion ReadLQuaternion()
|
||||
public Quaternion ReadQuaternion()
|
||||
{
|
||||
return new Quaternion()
|
||||
{
|
||||
|
@ -217,7 +217,8 @@ namespace RageCoop.Core
|
||||
|
||||
public Vector3 Position { get; set; }
|
||||
|
||||
public Vector3 Rotation { get; set; }
|
||||
public Quaternion Quaternion { get; set; }
|
||||
// public Vector3 Rotation { get; set; }
|
||||
|
||||
public Vector3 Velocity { get; set; }
|
||||
|
||||
@ -242,8 +243,9 @@ namespace RageCoop.Core
|
||||
byteArray.AddVector3(Position);
|
||||
|
||||
|
||||
// Write rotation
|
||||
byteArray.AddVector3(Rotation);
|
||||
// Write quaternion
|
||||
//byteArray.AddVector3(Rotation);
|
||||
byteArray.AddQuaternion(Quaternion);
|
||||
|
||||
// Write velocity
|
||||
byteArray.AddVector3(Velocity);
|
||||
@ -283,8 +285,9 @@ namespace RageCoop.Core
|
||||
// Read position
|
||||
Position = reader.ReadVector3();
|
||||
|
||||
// Read rotation
|
||||
Rotation = reader.ReadVector3();
|
||||
// Read quaternion
|
||||
// Rotation = reader.ReadVector3();
|
||||
Quaternion=reader.ReadQuaternion();
|
||||
|
||||
// Read velocity
|
||||
Velocity =reader.ReadVector3();
|
||||
|
Loading…
x
Reference in New Issue
Block a user