File size: 2,264 Bytes
ff50694
c17ec01
ff50694
c17ec01
 
 
 
 
 
 
 
 
 
 
 
 
 
ff50694
c17ec01
ff50694
c17ec01
 
 
 
 
 
ff50694
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c17ec01
 
 
 
 
 
 
 
ff50694
c17ec01
 
 
 
 
 
ff50694
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
APP.core.physics = {};

APP.core.physics.defaultAimpoint = function (label) {
    const l = (label || "object").toLowerCase();
    if (l.includes("airplane") || l.includes("drone") || l.includes("uav") || l.includes("kite") || l.includes("bird")) {
        return { relx: 0.62, rely: 0.55, label: "engine" };
    }
    if (l.includes("helicopter")) {
        return { relx: 0.50, rely: 0.45, label: "rotor_hub" };
    }
    if (l.includes("boat") || l.includes("ship")) {
        return { relx: 0.60, rely: 0.55, label: "bridge/engine" };
    }
    if (l.includes("truck") || l.includes("car")) {
        return { relx: 0.55, rely: 0.62, label: "engine_block" };
    }
    return { relx: 0.50, rely: 0.55, label: "center_mass" };
};

APP.core.physics.aimpointByLabel = function (label) {
    const l = String(label || "").toLowerCase();
    if (l.includes("engine") || l.includes("fuel")) return { relx: 0.64, rely: 0.58, label: label };
    if (l.includes("wing")) return { relx: 0.42, rely: 0.52, label: label };
    if (l.includes("nose") || l.includes("sensor")) return { relx: 0.28, rely: 0.48, label: label };
    if (l.includes("rotor")) return { relx: 0.52, rely: 0.42, label: label };
    return { relx: 0.50, rely: 0.55, label: label || "center_mass" };
};

APP.core.physics.getKnobs = function () {
    const { $ } = APP.core.utils;
    const helPower = $("#helPower");
    const helAperture = $("#helAperture");
    const helM2 = $("#helM2");
    const helJitter = $("#helJitter");
    const helDuty = $("#helDuty");
    const helMode = $("#helMode");
    const atmVis = $("#atmVis");
    const atmCn2 = $("#atmCn2");
    const seaSpray = $("#seaSpray");
    const aoQ = $("#aoQ");
    const rangeBase = $("#rangeBase");

    if (!helPower) return {};

    const PkW = +helPower.value;
    const aperture = +helAperture.value;
    const M2 = +helM2.value;
    const jitter_urad = +helJitter.value;
    const duty = (+helDuty.value) / 100;
    const mode = helMode ? helMode.value : "cw";
    const vis_km = +atmVis.value;
    const cn2 = +atmCn2.value;
    const spray = +seaSpray.value;
    const ao = +aoQ.value;
    const baseRange = +rangeBase.value;
    return { PkW, aperture, M2, jitter_urad, duty, mode, vis_km, cn2, spray, ao, baseRange };
};