Unexpected results from setting relative rotation on child of child in BP.

Also confirmed in Main CL 4302610

"I have found that changing this code from RelativeRotationCache . RotatorToQuat (NewRelativeRotation); to RelativeRotationCache.QuatToRotator(NewRotationQuat); in bool USceneComponent::InternalSetWorldLocationAndRotation(FVector NewLocation, const FQuat& RotationQuat, bool bNoPhysics, ETeleportType Teleport) in SceneComponent.cpp fixes the problem but there is a comment above that line explaining why the Quaternion is generated from the Rotator and not the opposite. I guess it could be fixed by checking if we are in the construction script (or if the component has not begun play yet) and generate the Quat from the Rot in that case, otherwise generate the Rot from the Quat. That still wouldn't fix the problem in BP and begin play but it is an improvements."



Steps to Reproduce

Example Project Attached

  1. Create a new BP actor with a scene component as a root.
  2. Create 3 additional scene components, Each of them being the only child of another.
  3. Set the rotation of the first scene component below the root as X 0 Y 0 Z 270 (in the blueprint)
  4. Set the rotation of the second component as X 0 Y 0 Z 90 Set the rotation of the third component as X 0 Y -90 Z 0 The location doesn't seem to matter but leave it as 0 as that's what i had.
  5. Place the actor in a level and set the relative rotation of the actor/root component as X 0 Y 0 Z 180 (make sure it's not set back to 179.999 because of the quat/rot conversion). In the tick of the actor BP, call SetRelativeRotation( (not add) on the 3rd component (the 3rd below the root), and increment the X/Roll manually, starting from the component own RelativeRotation, while keeping the Y/Pitch to -90 and the Z/Yaw to 0.
  6. PIE - Select Actor and find Scene component

Result: Different rotation values will be set

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-63188 in the post.

Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.
CreatedAug 21, 2018
ResolvedAug 18, 2021
UpdatedAug 18, 2021
Pull Requests
6204 - Filoppi
View Jira Issue