I know that there are a bunch of people who have asked about 6 DOF movement, gimbal lock solutions etc, but I have searching for a blueprint solution to gimbal lock in Third Person Template for about 2.5 weeks now and I have finally given up, as it seems it MUST be done within C++.
While I have very basic C++ knowledge, I am trying to avoid using C++ at all for this, but will if it the only solution.
I am not that great at maths or physics, but I do understand Gimbal lock and why it happens. I also THINK I have a general grasp of Quaternions (been looking at a bunch of explanations), and why they are important as a solution to the gimbal lock problem, but unfortunately, I am not sure about how to implement a work-around within blueprints. I can see that there is a “Make Quat” node, but it is a struct, and the only thing I can really do from that is break the struct, I am not sure how I could convert that Quat back to a Euler rotation, if that is even what I have to do.
From what I can see, PenguinTD posted a snippet of the code from inside of the Combine Rotators node:
FRotator UKismetMathLibrary::ComposeRotators(FRotator A, FRotator B)
{
FQuat AQuat = FQuat(A);
FQuat BQuat = FQuat(B);
return FRotator(BQuat*AQuat);
}
Which to me, says “Create 2 Quaternion’s (AQuat and BQuat), AQuat contains X,Y,Z information from FRotator A, and BQuat from FRotator B. So if Frotator A = 0,90,0, and FRotator B = 45,0,0, then the function would return A rotator value of 0,0,0”…is this right?
While I have left, right, up, down and roll movements all working ok, the pitch and yaw movements are problematic. And from what I have read, everyone says to use Quaternions. I also was reading that “Combine Rotators” node has in build Euler to Quaternion conversion, but I can’t even work out how to use rotators in this instance and it is making me feel rather stupid
Zero-G will play a part in my game, so this is pretty important.
If I work out a solution on my own, I will definitely be posting it for everyone else, but I have a feeling I won’t work out a solution at this rate.
Thank you in advance. Any help is greatly appreciated.