I think the bigger challenge here is having all engines gimbal in the intended direction.
So I worked on the core stage and it works ! Another quick drawing as a reference :
Pitch : nozzles 3 & 4 rotate on the x axis
Yaw : nozzles 1 & 2 rotate on the y axis
Roll : nozzles 3 +x ; 4 -x (and vice versa) *
* The roll channel is most tricky, because it can't have "dedicated" nozzles. I choosed nozzles 3 & 4, but it would work with 1 & 2 on the y axis as well. So the way I see it, pitch & yaw channels should have priority over roll channel. The roll channel has to be "opportunistic" and execute commands when there are no pitch (or yaw) inputs. Maybe the best way to have this working is to assign both "couples" (1&2 ; 3&4) to the roll channels, with a rule "if any roll input, perform it if (or as soon as) the pitch or yaw channels (or both) are "free"". It sounds a bit complex and won't be easy to code, but I think it can be done.
Another thing is how to implement a "smooth" nozzle animation and assign a max transition speed. I found that code sample from the HST.cpp from OrbiterSDK, but I'm not very happy with it, because it describes a "switch" animation. I need something more dynamic, and I care little about stuff like "DOOR_CLOSING, DOOR_CLOSED" because I don't want to save that data to a scenario file (saving the simulation state in the middle of a rocket launch is not something I do, and even if I want to implement that there's no need for saving the position of the nozzles, they will be loaded in "neutral" position, then the player or AP takes control and resume the flight).
Code:
// Animate hi-gain antenna
if (ant_status >= DOOR_CLOSING) {
double da = simdt * ANTENNA_OPERATING_SPEED;
if (ant_status == DOOR_CLOSING) {
if (ant_proc > 0.0) ant_proc = max (0.0, ant_proc-da);
else ant_status = DOOR_CLOSED;
} else {
if (ant_proc < 1.0) ant_proc = min (1.0, ant_proc+da);
else ant_status = DOOR_OPEN;
}
SetAnimation (anim_ant, ant_proc);
}
Last edited: