Hi, I am new to JME so bear with me. I am trying to write a basic flight simulator. I have an aircraft spatial that I need to rotate about the pitch (lateral) axis, the roll (longitudinal) axis and the yaw (vertical) axis. The aircraft is positioned ahead of the player so that you effectively have a chase camera view. When trying to rotate the aircraft, it seems to be locked to the preset X, Y and Z axes. So, initially if I roll the aircraft, it appears to roll correctly. However, when I pitch the aircraft up to a 90 degree position and then try and roll the aircraft for example, then it appears to yaw instead. (This seems to be because the rotation in roll is set about the Z axis and when the aircraft is pitched up 90 degrees then the Z axis runs through the top of the aircraft and not longitudinally as it was when the aircraft was at zero pitch).
What I am trying to achieve is that regardless of the aircrafts orientation in space, the controls will either pitch, roll or yaw the aircraft about the actual longitudinal, lateral and vertical axes of the aircraft (not the X, Y and Z) axes of the space it is in.
I have a flight model that returns a pitch angle, yaw angle, and roll angle relative to an absolute zero (ie straight and level and flying into the screen). So, each cycle I am trying to calculate the orientation of the aircraft based on these angles. (I am not trying to increment the angles each cycle when calculating the rotations because the flight model takes care of that and I just need to orientate the model correctly and place it on the screen).
I have tried reading as much as I can on the forums and the documentation, but I cant find anything that specifically deals with this. I am aware of things such as the order of the rotations, and angles in radians etc.
Initially I created a quaterion from all three angles and then applied that rotation to the spatial. This gave the result above. I then tried creating three separate quaterions for each axis of rotation and then multiplied them together using mult. This gave the same result. I have since tried to fromAngleNormalAxis to try and establish axes relative to the aircraft and then create quaterions based on these axes and then multiply them to get the overall rotation but to no avail!
I am sure that this is a problem that many people deal with, and I am sure that there is a simple solution. Please forgive my lack of correct terminology, or perhaps lack of understanding, but any help would be appreciated. At this stage I have not posted any code as I think it is a conceptual problem rather than a coding problem, however if you need me to post code, then I can. (our internet here in Papua New Guinea is pretty bad, so forgive any delays in responding!).
Thanks in advance