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.
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.
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
Create “BP_Test03”, which has a ‘DefaultSceneRoot’ in the Root and a ‘StaticMesh’ as a child.
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
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
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
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.
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.