SetWorldLocation actually sets the value relatively

In Blueprint’s ConstructionScript, I entered (0,0,0) for the Location of the StaticMesh component attached to the Scene component in SetWorldLocation, but it is actually (100,0,0) or some other different This is probably due to the Scene’s coordinates.
This probably inherits the Scene’s coordinates.

I believe the Set World Location(Target is Scene Component) node specifies World coordinates, and I believe it is a bug that it is being reflected as relative coordinates from the attaching parent.
I am not familiar with Attach or ConstructionScript for components, so if this is the correct behavior I would appreciate you pointing it out.

Blueprint screen and operation check
https://youtu.be/Fuaxlqnym2E

バージョン: 5.4.1-33305029+++UE5+Release-5.4
プラットフォーム: Windows 11 (22H2) [10.0.22621.3527] (x86_64)

But you’re attaching the component, so it will follow the scene and ignore the world location setting…?

To see if this was caused by dragging and moving the Scene with the mouse later, the following steps were performed.

Place the Actor on the level in advance and move the position of the Scene component, which is a child of DefaultSceneRoot.
Then, reconnect the lines in the ConstructionScript, etc., and compile again to execute the code again. (The line glows orange on the BP screen to indicate that it has been executed.)
I expected that the StaticMesh would definitely be at (0,0,0) at this point, since BP is executing SetWorldLocation (0,0,0) at the end.

Result
In fact, we are already at “the position moved from (0,0,0) by the relative coordinates of the Scene component.

operation check
https://youtu.be/UUSkr2EBsdQ

I can verify that ‘set world location’ does work :slight_smile:

If you move components individually after placing the blueprint in the level, especially if one of them in attached, I’m not sure what is supposed to happen then.

The following steps were taken to see what would happen if the only ‘SetWorldLocation’ node in ConstructionScript was called.

Preparation

  1. Create “BP_Test03”, which has a ‘DefaultSceneRoot’ in the Root and a ‘StaticMesh’ as a child.
  2. BP_Test03” is running SetWorldLocation in ConstructionScript, Target is a StaticMesh component and NewLocation is (0, 0, 0). (By this I expect the Mesh to always be at (0, 0, 0) no matter where this BP is placed on the level.)

The following tests are performed in order from top to bottom.

Test A

  1. place BP_Test03 on the level and move BP_Test03

Test A Result
The mesh is always at (0, 0, 0) immediately after placement and after moving. This seems to be normal behavior.

Test B

  1. select the StaticMesh component of BP_Test03, grab it with the mouse and move it around.

Test B Result
MeshComponent’s Transform’s Location value changes, and the mesh is also moved on the view window.
Perhaps moving a component does not re-run the ConstructionScript?
If so, this seems like normal behavior.

Test C

  1. compile BP_Test03 again.

Test C Result
The Mesh is at (0, 0, 0); the Location value in MeshComponent’s Transform is also multiplied by -1 to the Root’s coordinates so that the Mesh will eventually be at (0, 0, 0). (If Root is (10, 20, 30), then Mesh will be (-10, -20, -30))
This seems to be normal behavior.

Conclusion.
The process seems normal when simply running the SetWorldLocation node in ConstructionScript.
The ‘Attach Component to Component’ node is most likely affecting the question.

operation check
https://youtu.be/XApfJk5tLBU

Apparently the problem is related to the fact that the execution timing is in ContructionScript.

This is the BP in the first post of this question, in case you run into problems.


Attach and SetWorldLocation within ContructionScript.

Here is the view window when this BP is compiled.
スクリーンショット 2024-05-06 180521
Mesh coordinates are not (0, 0, 0). (Bug?)

Next is the case where all processing in the ContructionScript is deleted and connected directly to the Begin event in the event graph.

This image shows a test play of the game in the selected viewport.


The call should be exactly the same except it is a Begin node, but the result is that the mesh is at (0, 0, 0). This seems to be the correct behavior.

In other words, this is a problem that probably only occurs in ContructionScript.

Note
My reason for wanting to use ContructionScript is due to the following circumstances.
I am currently attempting to create a zipline for Unreal Quest 1.
I have set DefaultSceneRoot as the center of the scaffolding that the character will access, and placed a Spline on its child.The Spline is the starting point of the zip line, so it has an Offset from the coordinates of the DefaultSceneRoot.
I was trying to decorate the look with SplineMeshComponent and StaticMesh on that Spline and ran into the problem with this question.
The reason I want to use ContructionScript is that it is smoother to have the look of the decorated robe when placing and editing the zip line.