Ped movement change

This commit is contained in:
Sardelka
2022-07-17 14:23:19 +08:00
parent 2605aafc4f
commit 228ab9e727
2 changed files with 11 additions and 6 deletions

View File

@ -640,6 +640,7 @@ namespace RageCoop.Client
private bool LastMoving; private bool LastMoving;
private void WalkTo() private void WalkTo()
{ {
Function.Call(Hash.SET_PED_STEALTH_MOVEMENT, MainPed, IsInStealthMode, 0);
Vector3 predictPosition = Position + (Position - MainPed.Position) + Velocity * 0.5f; Vector3 predictPosition = Position + (Position - MainPed.Position) + Velocity * 0.5f;
float range = predictPosition.DistanceToSquared(MainPed.Position); float range = predictPosition.DistanceToSquared(MainPed.Position);
@ -696,19 +697,21 @@ namespace RageCoop.Client
MainPed.PositionNoOffset=Position; MainPed.PositionNoOffset=Position;
return; return;
} }
var f = dist*(Position+SyncParameters.PositioinPredictionDefault*Velocity-MainPed.Position)+(Velocity-MainPed.Velocity)*0.2f; // var f = dist*(Position+SyncParameters.PositioinPredictionDefault*Velocity-MainPed.Position)+(Velocity-MainPed.Velocity)*0.2f;
if (!localRagdoll) { f*=5; } // if (!localRagdoll) { f*=5; }
if (!(localRagdoll|| MainPed.IsDead)) if (!(localRagdoll|| MainPed.IsDead))
{ {
MainPed.Rotation=Rotation; MainPed.Heading=Heading;
if (MainPed.Speed<0.05) { f*=10; MainPed.Heading=Heading; } MainPed.Velocity=Velocity+5*dist*(Position-MainPed.Position);
// if (MainPed.Speed<0.05) { f*=10; MainPed.Heading=Heading; }
} }
else if (Main.Ticked-_lastRagdollTime<10) else if (Main.Ticked-_lastRagdollTime<20)
{ {
return; return;
} }
MainPed.ApplyForce(f); // MainPed.ApplyForce(f);
} }
private string LoadAnim(string anim) private string LoadAnim(string anim)
{ {
ulong startTime = Util.GetTickCount64(); ulong startTime = Util.GetTickCount64();

View File

@ -180,6 +180,7 @@ namespace RageCoop.Client
// Main.Logger.Debug($"Removing ped {c.ID}. Reason:{reason}"); // Main.Logger.Debug($"Removing ped {c.ID}. Reason:{reason}");
p.AttachedBlip?.Delete(); p.AttachedBlip?.Delete();
p.Kill(); p.Kill();
p.Model.MarkAsNoLongerNeeded();
p.MarkAsNoLongerNeeded(); p.MarkAsNoLongerNeeded();
p.Delete(); p.Delete();
} }
@ -245,6 +246,7 @@ namespace RageCoop.Client
} }
// Main.Logger.Debug($"Removing vehicle {v.ID}. Reason:{reason}"); // Main.Logger.Debug($"Removing vehicle {v.ID}. Reason:{reason}");
veh.AttachedBlip?.Delete(); veh.AttachedBlip?.Delete();
veh.Model.MarkAsNoLongerNeeded();
veh.MarkAsNoLongerNeeded(); veh.MarkAsNoLongerNeeded();
veh.Delete(); veh.Delete();
} }