private static void ApplyThrustForce(Entity entity, Vector3 origin, Vector3 direction, float scale) { if (Function.Call <int>(Hash.GET_VEHICLE_CLASS, entity) == 16 || entity.HeightAboveGround > 15.0f) { return; } float entityDist = Vector3.Distance(entity.Position, origin); float zForce, scaleModifier; Vector3 rotationalForce; if (entity is Vehicle) { zForce = RandomEx.GetBoolean(0.50f) ? 0.0332f : 0.0318f; scaleModifier = 22.0f; rotationalForce = new Vector3(0.0f, 0.1f, 0.40f); } else if (entity is Ped) { if (((Ped)entity).IsRagdoll == false) { Function.Call(Hash.SET_PED_TO_RAGDOLL, entity.Handle, 800, 1500, 2, 1, 1, 0); } zForce = 0.0034f; scaleModifier = 30.0f; rotationalForce = new Vector3(0.0f, 0.0f, 0.12f); } else { zForce = 0.000f; scaleModifier = 30.0f; rotationalForce = new Vector3(0.0f, 0.338f, 0.0f); } var force = (direction + new Vector3(0, 0, zForce)) * Math.Min(1.0f, scaleModifier / entityDist) * scale; entity.ApplyForce(force, rotationalForce, ForceType.MaxForceRot); }