Hi, I need some help with a 3d mesh instance behavior. I'm trying to understand why the body's angular speed is relative to its direction. I recorded a short video to illustrate the issue :
I pitch the body up (around X axis) at the start of the video, then roll around its Z axis, but instead of having an independant rotation on both axis, the "pitch up" angular speed goes toward the direction of the body after I roll it. Basically I want the body to behave like an object in space, so the angular speed of each axis should not "steer" the object. I apply a torque multiplied by the "ship" basis btw.
What am I missing?
Tellurate well I've checked this already and it doesn't really help me, I mean it's an usefull doc but I still don't see how I can do what I want. Maybe I missed something I don't know.
Thanks for the reply anyway!
All right so in case someone ends up in the same situation a me I managed to solve this problem as such:
I created three rigid body 3d for each axis. Top mode is enabled on each, i set their position on the ship each frames.
I locked the angular axis irrelevant to each axis, the pitch axis (around X) is locked on Y and Z axis, the yaw (Y) axis is locked on X and Z and roll axis (Z) on X and Y
I then use "get_rotation()" to obtain the rotation of each axis and create a Vector3 from each relevant axis. So you take the X axis rotation for the pitch, Y rotation for yaw etc...
I set the ship rotation ("set_rotation()") with the previously obtained Vector3
You can then apply a torque ("apply_torque()") to the three rigid body axis.
It creates other problems when applying torque as you might be gimbal locked on some positions, so you need to multiply your torque by a reference basis.
note: put all function in physics process or the simulation will break.
Video of result:
Oech As a general advice, don't ever use euler angles for managing 3d orientation in any way. Always do it exclusively via quaternions. Much easier and less glitch/bug prone.
© 2022 - 2024 — McMap. All rights reserved.