Apply positional calibration force to center of mass

This commit is contained in:
Sardelka9515
2023-03-08 18:33:40 +08:00
parent 63f11053c7
commit cc92d1ad2b
2 changed files with 2 additions and 2 deletions

View File

@ -640,7 +640,7 @@ namespace RageCoop.Client
// localRagdoll // localRagdoll
var force = Velocity - MainPed.Velocity + 5 * dist * (predicted - MainPed.ReadPosition()); var force = Velocity - MainPed.Velocity + 5 * dist * (predicted - MainPed.ReadPosition());
if (force.Length() > 20) force = force.Normalized * 20; if (force.Length() > 20) force = force.Normalized * 20;
MainPed.ApplyForce(force, default, ForceType.InternalImpulse); MainPed.ApplyWorldForceCenterOfMass(force, ForceType.InternalImpulse, true);
} }
} }

View File

@ -174,7 +174,7 @@ namespace RageCoop.Client
if (distSquared > 0.03 * 0.03) if (distSquared > 0.03 * 0.03)
{ {
if (IsTrain || distSquared > 20 * 20) MainVehicle.Velocity = Velocity + cali; if (IsTrain || distSquared > 20 * 20) MainVehicle.Velocity = Velocity + cali;
else MainVehicle.ApplyForce(cali, default, ForceType.InternalImpulse); else MainVehicle.ApplyWorldForceCenterOfMass(cali, ForceType.InternalImpulse, true);
} }
Quaternion predictedQuat = updated ? Quaternion : Quaternion predictedQuat = updated ? Quaternion :