Do you use Quarternions? [Fixed!]

So it turns out that the extra rotation is caused by combining this regular Pitch/Roll/Yaw rotation (which works fine on it’s own), with the Self-Righting rotation/force. Rotating around the actors local vectors seems 100% fine until the following code and the above code come into play with one another.

Here’s the self-righting code, which simulates a rotational force and applies it directly as velocity. What I find odd, is that the self-righting code does NOTHING in the Z-axis at all, so how this is happening I have no idea. So bloody confused… never doing Physics programming after this again :stuck_out_tongue:



	// --- Transform Alpha To Correct Local Rotation --------------------------------------------------------
	/* Get the Z-UnRotated Cross Product of The Actors Right Vector and the Normal */
	FVector UnrotatedRCrossN = FRotator(FRotationMatrix::MakeFromZX(Normal, FVector::CrossProduct(UpdatedComponent->GetRightVector(), Normal)).Rotator()).UnrotateVector(UpdatedComponent->GetRightVector());
	///* Get the Z-Orientated Rotation Of the Cross Product Of the Z-Unrotated Vector, and the Normal */
	FRotator FinalRotation = FRotationMatrix::MakeFromZX(Normal, FVector::CrossProduct(UnrotatedRCrossN, Normal)).Rotator();
	///* Get the Right and Front Axis Vectors of the Rotation */
	FVector NormRight = FRotationMatrix(FinalRotation).GetScaledAxis(EAxis::Y);
	FVector NormFront = FRotationMatrix(FinalRotation).GetScaledAxis(EAxis::X);

	FVector RightVector = FVector(ScaledTrack * FVector::DotProduct(NormRight, UpdatedComponent->GetUpVector()), ScaledTrack * FVector::DotProduct(NormFront, UpdatedComponent->GetUpVector()), 0.f);
        Alpha.X += RightVector.X;
        Alpha.Y -= RightVector.Y;


Anybody have any ideas what could be happening?