Files
VS--Improved-Aerodynamics/src/main/java/dev/lumareth/improvedAerodynamics/exhaust/NozzleMixing.java
T
richard 70eb237d70 Add vectored afterburner nozzle with afterburner key and exhaust style
- Add vectored afterburner nozzle block with AzureLib model, deflection, throttle and afterburner state
- Drive nozzles from the vehicle control node and map pitch, roll and yaw to differential deflection
- Add afterburner toggle key and packet, linked to the control node
- Replace Warium exhaust effect entities with improved flames, particles and sounds when exhaustStyle is improved
- Add /aero seedgen to measure the air ceiling for the air placeholder
- Upgrade Warium VS to 1.1.7 and make the lift use horizontal speed
2026-11-11 18:00:46 +01:00

30 lines
1.8 KiB
Java

package dev.lumareth.improvedAerodynamics.exhaust;
import dev.lumareth.improvedAerodynamics.Config;
/**
* Turns pilot inputs into the deflection of one nozzle of a twin engine craft: the same sign on both engines pitches,
* opposite signs roll and yaw. The nozzles hinge on canted axes, so deflecting them against each other turns the exhaust
* sideways as well as up and down: the vertical parts make a rolling moment, the sideways parts push the tail around.
* That coupling is how an Su-57 yaws with its nozzles, so roll and yaw share the one differential channel. Positive
* deflection always means the exhaust swings up, on both sides. Not tied to any input source, whatever drives the
* nozzles calls this and then {@link NozzleBlockEntity#setDeflectionTarget}.
*/
public final class NozzleMixing {
private NozzleMixing() {
}
/**
* @param pitchUp -1 to 1, positive raises the nose, which takes the exhaust up
* @param rollRight -1 to 1, positive rolls the plane right, which takes the right engine's exhaust up and the left one's down
* @param yawRight -1 to 1, positive yaws the nose right. The left engine's exhaust swings up and the right one's down,
* which for this model's canting turns both sideways to the left and pushes the tail left
* @return target deflection in radians, within the configured limit
*/
public static float deflection(float pitchUp, float rollRight, float yawRight, boolean rightEngine) {
float differential = rollRight - yawRight * Config.NOZZLE_YAW_MIX.get().floatValue();
float mixed = Math.max(-1.0F, Math.min(1.0F, pitchUp + (rightEngine ? differential : -differential)));
return mixed * (float) Math.toRadians(Config.NOZZLE_MAX_DEFLECTION.get());
}
}