I want to create a Blueprint where a dice moves continuously on a grid-based map by rotating 90 degrees on a flat surface. It will rotate to move forward, backward, left, or right, but it should not rotate around the axis perpendicular to the ground.
Here is how my Blueprint works: I placed reference points in front of and to the right of the dice. Then, I get the right vector from the right-side reference point and use this vector in a quaternion formula to calculate a quaternion that represents a 90-degree rotation around this vector. I then multiply this result with the stored current rotation and use a timeline animation to interpolate between these two quaternions to achieve my goal. The same process is used for forward rotation.
When rotating in a single direction, it works well.
However, when I rotate forward or backward an odd number of times and then rotate right or left, the dice starts rotating around the axis perpendicular to the ground. The same issue occurs if I rotate right or left an odd number of times and then rotate forward or backward. Notably, rotating twice doesn’t cause this problem.
I would like to know what is happening during this process or if there is another method to avoid this issue.
Thank you for your help.