Download

Help with 6DoF control rotation

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.

Look at my 6DOF plugin it may help you

Downloading now… Thanks! Hell if it actually helps I’ll donate to you. That makes me think there should be a service or site that allows small donations for UE4 assistance. Yeah going through the process to learn is key but there are certainly times where too much time is lost and the problem could be very simple. It’s when I’m past that where I think “yeah I’d pay for some direction”…

Hey so the 6DoF project is very helpful, I have a question/ problem I’m running into. In the Movement component I see that in your setCustomMovementMode function you’re asking for a TEnumAsByte<ECustomMovementMode::Type> NewMovementMode, I’m getting compile errors on my project side. Yet the actual project file of yours works fine. Says can’t convert from uint8 to TEnumAsByte<ECustomMovementMode::Type>. Any ideas what would be causing this?