mirror of
https://github.com/l0k1/oprf_assets.git
synced 2024-11-01 07:41:15 +08:00
Update of missile-code
This commit is contained in:
parent
ac519b3e89
commit
1b1504a4b1
@ -1600,6 +1600,7 @@ var AIM = {
|
|||||||
me.sun_enabled = TRUE;
|
me.sun_enabled = TRUE;
|
||||||
me.sun = geo.Coord.new();
|
me.sun = geo.Coord.new();
|
||||||
me.sun.set_xyz(me.ac_init.x()+sun_x*2000000, me.ac_init.y()+sun_y*2000000, me.ac_init.z()+sun_z*2000000);#heat seeking missiles don't fly far, so setting it 2000Km away is fine.
|
me.sun.set_xyz(me.ac_init.x()+sun_x*2000000, me.ac_init.y()+sun_y*2000000, me.ac_init.z()+sun_z*2000000);#heat seeking missiles don't fly far, so setting it 2000Km away is fine.
|
||||||
|
me.sun.alt();# TODO: once fixed in FG this line is no longer needed.
|
||||||
} else {
|
} else {
|
||||||
# old FG versions does not supply location of sun. So this feature gets disabled.
|
# old FG versions does not supply location of sun. So this feature gets disabled.
|
||||||
me.sun_enabled = FALSE;
|
me.sun_enabled = FALSE;
|
||||||
@ -3581,8 +3582,8 @@ var AIM = {
|
|||||||
me.raw_steer_signal_head = me.curr_deviation_h;
|
me.raw_steer_signal_head = me.curr_deviation_h;
|
||||||
if (me.cruise_or_loft == FALSE) {
|
if (me.cruise_or_loft == FALSE) {
|
||||||
me.raw_steer_signal_elev = me.curr_deviation_e;
|
me.raw_steer_signal_elev = me.curr_deviation_e;
|
||||||
me.attitudePN = math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) * R2D;
|
me.attitudePN = (math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) - math.atan2(-me.speed_down_fps, me.speed_horizontal_fps )) * R2D;
|
||||||
me.gravComp = me.pitch - me.attitudePN;
|
me.gravComp = - me.attitudePN;
|
||||||
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
||||||
me.raw_steer_signal_elev += me.gravComp;
|
me.raw_steer_signal_elev += me.gravComp;
|
||||||
}
|
}
|
||||||
@ -3733,8 +3734,8 @@ var AIM = {
|
|||||||
}
|
}
|
||||||
if (me.fixed_aim != nil and me.life_time < me.fixed_aim_time) {
|
if (me.fixed_aim != nil and me.life_time < me.fixed_aim_time) {
|
||||||
me.raw_steer_signal_elev = me.curr_deviation_e+me.fixed_aim;
|
me.raw_steer_signal_elev = me.curr_deviation_e+me.fixed_aim;
|
||||||
me.attitudePN = math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) * R2D;
|
me.attitudePN = (math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) - math.atan2(-me.speed_down_fps, me.speed_horizontal_fps )) * R2D;
|
||||||
me.gravComp = me.pitch - me.attitudePN;
|
me.gravComp = - me.attitudePN;
|
||||||
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
||||||
me.raw_steer_signal_elev += me.gravComp;
|
me.raw_steer_signal_elev += me.gravComp;
|
||||||
} else {
|
} else {
|
||||||
@ -3792,8 +3793,8 @@ var AIM = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# now compensate for the predicted gravity drop of attitude:
|
# now compensate for the predicted gravity drop of attitude:
|
||||||
me.attitudePN = math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) * R2D;
|
me.attitudePN = (math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) - math.atan2(-me.speed_down_fps, me.speed_horizontal_fps )) * R2D;
|
||||||
me.gravComp = me.pitch - me.attitudePN;
|
me.gravComp = -me.attitudePN;
|
||||||
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
||||||
me.raw_steer_signal_elev += me.gravComp;
|
me.raw_steer_signal_elev += me.gravComp;
|
||||||
|
|
||||||
@ -3964,6 +3965,7 @@ var AIM = {
|
|||||||
me.crc_closestRange = me.myMath.magnitudeVector(me.myMath.minus(targetCoord, missileCoord));
|
me.crc_closestRange = me.myMath.magnitudeVector(me.myMath.minus(targetCoord, missileCoord));
|
||||||
me.crc_missileCoord = geo.Coord.new();
|
me.crc_missileCoord = geo.Coord.new();
|
||||||
me.crc_missileCoord.set_xyz(missileCoord[0], missileCoord[1], missileCoord[2]);
|
me.crc_missileCoord.set_xyz(missileCoord[0], missileCoord[1], missileCoord[2]);
|
||||||
|
me.crc_missileCoord.alt();# TODO: once fixed in FG this line is no longer needed.
|
||||||
},
|
},
|
||||||
|
|
||||||
log: func (str) {
|
log: func (str) {
|
||||||
|
@ -1600,6 +1600,7 @@ var AIM = {
|
|||||||
me.sun_enabled = TRUE;
|
me.sun_enabled = TRUE;
|
||||||
me.sun = geo.Coord.new();
|
me.sun = geo.Coord.new();
|
||||||
me.sun.set_xyz(me.ac_init.x()+sun_x*2000000, me.ac_init.y()+sun_y*2000000, me.ac_init.z()+sun_z*2000000);#heat seeking missiles don't fly far, so setting it 2000Km away is fine.
|
me.sun.set_xyz(me.ac_init.x()+sun_x*2000000, me.ac_init.y()+sun_y*2000000, me.ac_init.z()+sun_z*2000000);#heat seeking missiles don't fly far, so setting it 2000Km away is fine.
|
||||||
|
me.sun.alt();# TODO: once fixed in FG this line is no longer needed.
|
||||||
} else {
|
} else {
|
||||||
# old FG versions does not supply location of sun. So this feature gets disabled.
|
# old FG versions does not supply location of sun. So this feature gets disabled.
|
||||||
me.sun_enabled = FALSE;
|
me.sun_enabled = FALSE;
|
||||||
@ -3581,8 +3582,8 @@ var AIM = {
|
|||||||
me.raw_steer_signal_head = me.curr_deviation_h;
|
me.raw_steer_signal_head = me.curr_deviation_h;
|
||||||
if (me.cruise_or_loft == FALSE) {
|
if (me.cruise_or_loft == FALSE) {
|
||||||
me.raw_steer_signal_elev = me.curr_deviation_e;
|
me.raw_steer_signal_elev = me.curr_deviation_e;
|
||||||
me.attitudePN = math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) * R2D;
|
me.attitudePN = (math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) - math.atan2(-me.speed_down_fps, me.speed_horizontal_fps )) * R2D;
|
||||||
me.gravComp = me.pitch - me.attitudePN;
|
me.gravComp = - me.attitudePN;
|
||||||
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
||||||
me.raw_steer_signal_elev += me.gravComp;
|
me.raw_steer_signal_elev += me.gravComp;
|
||||||
}
|
}
|
||||||
@ -3733,8 +3734,8 @@ var AIM = {
|
|||||||
}
|
}
|
||||||
if (me.fixed_aim != nil and me.life_time < me.fixed_aim_time) {
|
if (me.fixed_aim != nil and me.life_time < me.fixed_aim_time) {
|
||||||
me.raw_steer_signal_elev = me.curr_deviation_e+me.fixed_aim;
|
me.raw_steer_signal_elev = me.curr_deviation_e+me.fixed_aim;
|
||||||
me.attitudePN = math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) * R2D;
|
me.attitudePN = (math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) - math.atan2(-me.speed_down_fps, me.speed_horizontal_fps )) * R2D;
|
||||||
me.gravComp = me.pitch - me.attitudePN;
|
me.gravComp = - me.attitudePN;
|
||||||
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
||||||
me.raw_steer_signal_elev += me.gravComp;
|
me.raw_steer_signal_elev += me.gravComp;
|
||||||
} else {
|
} else {
|
||||||
@ -3792,8 +3793,8 @@ var AIM = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# now compensate for the predicted gravity drop of attitude:
|
# now compensate for the predicted gravity drop of attitude:
|
||||||
me.attitudePN = math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) * R2D;
|
me.attitudePN = (math.atan2(-(me.speed_down_fps+g_fps * me.dt), me.speed_horizontal_fps ) - math.atan2(-me.speed_down_fps, me.speed_horizontal_fps )) * R2D;
|
||||||
me.gravComp = me.pitch - me.attitudePN;
|
me.gravComp = -me.attitudePN;
|
||||||
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
#printf("Gravity compensation %0.2f degs", me.gravComp);
|
||||||
me.raw_steer_signal_elev += me.gravComp;
|
me.raw_steer_signal_elev += me.gravComp;
|
||||||
|
|
||||||
@ -3964,6 +3965,7 @@ var AIM = {
|
|||||||
me.crc_closestRange = me.myMath.magnitudeVector(me.myMath.minus(targetCoord, missileCoord));
|
me.crc_closestRange = me.myMath.magnitudeVector(me.myMath.minus(targetCoord, missileCoord));
|
||||||
me.crc_missileCoord = geo.Coord.new();
|
me.crc_missileCoord = geo.Coord.new();
|
||||||
me.crc_missileCoord.set_xyz(missileCoord[0], missileCoord[1], missileCoord[2]);
|
me.crc_missileCoord.set_xyz(missileCoord[0], missileCoord[1], missileCoord[2]);
|
||||||
|
me.crc_missileCoord.alt();# TODO: once fixed in FG this line is no longer needed.
|
||||||
},
|
},
|
||||||
|
|
||||||
log: func (str) {
|
log: func (str) {
|
||||||
|
BIN
S-75/Sounds/launch.wav
Normal file
BIN
S-75/Sounds/launch.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user