Use InternalImpulse to calibrate entity position
This commit is contained in:
@ -110,7 +110,7 @@ namespace RageCoop.Client
|
||||
packet.Position = veh.ReadPosition();
|
||||
packet.Velocity = veh.Velocity;
|
||||
packet.Quaternion = veh.ReadQuaternion();
|
||||
packet.RotationVelocity = veh.RotationVelocity;
|
||||
packet.RotationVelocity = veh.WorldRotationVelocity;
|
||||
packet.ThrottlePower = veh.ThrottlePower;
|
||||
packet.BrakePower = veh.BrakePower;
|
||||
v.LastSentStopWatch.Restart();
|
||||
|
@ -36,7 +36,6 @@ namespace RageCoop.Client
|
||||
|
||||
public static string BasePath = GetBasePath();
|
||||
public static string DataPath = Path.Combine(BasePath, "Data");
|
||||
public static string LogPath = Path.Combine(DataPath, "RageCoop.Client.log");
|
||||
public static string SettingsPath = Path.Combine(DataPath, "Setting.json");
|
||||
|
||||
public static string VehicleWeaponDataPath = Path.Combine(DataPath, "VehicleWeapons.json");
|
||||
|
@ -640,7 +640,7 @@ namespace RageCoop.Client
|
||||
// localRagdoll
|
||||
var force = Velocity - MainPed.Velocity + 5 * dist * (predicted - MainPed.ReadPosition());
|
||||
if (force.Length() > 20) force = force.Normalized * 20;
|
||||
MainPed.ApplyForce(force);
|
||||
MainPed.ApplyForce(force, default, ForceType.InternalImpulse);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace RageCoop.Client
|
||||
#region PRIVATE
|
||||
|
||||
private byte[] _lastVehicleColors = { 0, 0 };
|
||||
private Dictionary<int, int> _lastVehicleMods = new Dictionary<int, int>();
|
||||
private Dictionary<int, int> _lastVehicleMods = new();
|
||||
private bool _lastHornActive;
|
||||
private bool _lastTransformed;
|
||||
internal int _lastLivery = -1;
|
||||
|
@ -174,18 +174,16 @@ namespace RageCoop.Client
|
||||
if (distSquared > 0.03 * 0.03)
|
||||
{
|
||||
if (IsTrain || distSquared > 20 * 20) MainVehicle.Velocity = Velocity + cali;
|
||||
else MainVehicle.ApplyForce(cali);
|
||||
else MainVehicle.ApplyForce(cali, default, ForceType.InternalImpulse);
|
||||
}
|
||||
|
||||
Quaternion predictedQuat = updated ? Quaternion :
|
||||
Quaternion.Lerp(LastQuaternion, Quaternion, 1 + LastSyncedStopWatch.ElapsedMilliseconds / (float)LastSyncInterval);
|
||||
var curQuat = MainVehicle.Quaternion;
|
||||
MainVehicle.ApplyForce((predictedQuat * TopExtent - curQuat * TopExtent) * RotCalMult, TopExtent);
|
||||
MainVehicle.ApplyForce((predictedQuat * FrontExtent - curQuat * FrontExtent) * RotCalMult, FrontExtent);
|
||||
MainVehicle.ApplyForce((predictedQuat * TopExtent - curQuat * TopExtent) * RotCalMult, TopExtent, ForceType.InternalImpulse);
|
||||
MainVehicle.ApplyForce((predictedQuat * FrontExtent - curQuat * FrontExtent) * RotCalMult, FrontExtent, ForceType.InternalImpulse);
|
||||
// MainVehicle.ApplyForce((predictedQuat * BottomExtent - curQuat * BottomExtent) * RotCalMult, BottomExtent);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private bool CreateVehicle()
|
||||
|
@ -180,13 +180,6 @@ namespace RageCoop.Client
|
||||
return v;
|
||||
}
|
||||
|
||||
public static void ApplyForce(this Entity e, int boneIndex, Vector3 direction, Vector3 rotation = default,
|
||||
ForceType forceType = ForceType.MaxForceRot2)
|
||||
{
|
||||
Call(APPLY_FORCE_TO_ENTITY, e.Handle, forceType, direction.X, direction.Y, direction.Z,
|
||||
rotation.X, rotation.Y, rotation.Z, boneIndex, false, true, true, false, true);
|
||||
}
|
||||
|
||||
public static byte GetPlayerRadioIndex()
|
||||
{
|
||||
return (byte)Call<int>(GET_PLAYER_RADIO_STATION_INDEX);
|
||||
|
Reference in New Issue
Block a user