I’ve tried asking the question on the answerhub but I’m not getting any responses so I’m trying here. I’ve my own character class and character movement component. My CMP is custom because I have a round world and I need to be able to walk around all sides of it. So I went through and adjusted it to allow for that. In my character class in the tick function I do this:
FTransform orgRot(FRotationMatrix::MakeFromZX(GetCapsuleComponent()->GetComponentLocation(), GetCapsuleComponent()->GetForwardVector()).ToQuat()); FQuat addInRot = FRotator(0, mouseX, 0).Quaternion(); orgRot.ConcatenateRotation(addInRot); Controller->SetControlRotation(orgRot.Rotator());
The idea is that the control rotation upVector always points away from the world center. The mouseX value is the mouse x input value. The problem is that when I approach the axis poles of the world my character flips over on his head as the yaw value crosses over zero value either from negative to positive, or vise versa. I presume this is gimbal lock correct? What can I do to add those two rotations together so this doesn’t happen? The first rotation is from the MakeFromZX which points the capsule up vector the correct direction. The second is the FQuat I build from a rotator with the mouseX value in the yaw slot.