What could cause translations when only rotations are applied?

Hello all,

The main problem is already described in the question but I will explain the context. I have an actor that’s a 1:1 scale model of a real life mechanical watch and I created a C++ class to animate it. It isn’t animated using Timelines via bluebrint; it is entirely animated using my C++ class which I attach to the Blueprint which contains the hierarchy of static meshes as they are created in the company’s CAD program. This might not be important but I specify it anyways.

The FBX file is imported using the File → Import into Level method from the home interface which auto creates a Blueprint and actor in the current Level with a DefaultSceneRoot and all the children to this are SceneComponents which at the bottom contain the piece’s different meshes (eg. a cog with ID 1 will have two sub parts with IDs 1.1 and 1.2 whom are the driving axis and the cog and ID1.2 can be composed of 3 StaticMesh objects which are different surfaces of the same cog take a look at image hierarchy1 and 2 for reference).

214164-hierarchy1.png

214165-hierarchy2.png

When my C++ class rotates some specific parts it will either rotate a SceneComponent object or a StaticMesh, whereby the only rotating pieces that are of the latter object type are the hands of the watch. Here is a sample code of the rotation applied:

void UClockworkAnimations::JerkedRotation(MovablePiece* piece) {
	float timeframe = FMath::Sin(time*PI * 2 * frequency*timeRatio + piece->phase);
if (timeRatio > 1.1f) {
			//				y  = x   *           a                                  + b
			float currentangle = time*timeRatio*(piece->step*0.5) * (2 * frequency) + piece->b;
			piece->b = (FMath::IsNearlyZero(this->oldtimeRatio-timeRatio) ? 1 : -1) * (time*this->oldtimeRatio*(piece->step*0.5) * (2 * frequency));
			float angle = currentangle;
			double yaw = piece->axis.Z * angle + piece->initialRotation.Yaw;
			double pitch = piece->axis.Y * angle + piece->initialRotation.Pitch;
			double roll = piece->axis.X * angle + piece->initialRotation.Roll;
			FRotator outRot(pitch, yaw, roll);
			piece->sceneComponent->SetRelativeRotation(outRot);
		}

A lot of what’s happening in that code is related to my mathematical model of rotation for the parts but what’s important and relevant to the issue at hand is that the only change that is being applied to the SceneComponent/StaticMesh is the SetRelativeRotation with the calculated Rotator in the previous line on every frame (EventTick).

When this rotation is applied directly to a StaticMesh like in the case of the hands of the watch, the rotation applies correctly and the translation issue doesn’t occur however when the rotation applied this way on a SceneComponent like in the hierarchy2 image above on ID 7387_0260_1_00_1 aproximately 4 to 5 times a second the X and Y components of the Translation->Location vector of the SceneComponent change by a factor of 1x10^-6.

You can see the difference here:

214166-error-of-translation.gif

214167-error-of-translation2.gif

Now ofcourse, the easy solution would be to reset the translation on each frame but the real question is What is causing this and how can I bypass or correct this bug?

I’m getting something similar in 4.19. I have a propeller parented to an airplane and when it rotates it causes a weird translation to the point that the prop hub looks like its wobbling violently. It doesn’t do this pre-export from Maya, animations were baked out and it only seems to happen after import. It was just a simple rotation 0-360 degrees, 24FPS, on a loop.