Hello,
the linked code should attach the USceneCaptureComponent2D to the root/SceneComponent, so it’s transform should depend from it’s parent.
I found out that it’s not enough: AddWorldOffset and AddWorldRotation should be called with GetActorLocation/GetActorRotation inside the constructor/begin play to actually get the scene capture to move from the origin.
When I add the code you linked to an custom class based on actor there is an error with the reference to USceneCaptureComponent2D. Is there an additional include statement you’re using other than what is auto generated when the class is created? Could you post the header and source file for your class so we can see how you are creating the ‘root’ and ‘sceneCapture’ variables as well as how they are used in the class?
Hi ,
you can find the header file here.
As you can see, I didn’t include anything about of the ordinary. To reproduce the bug, just drag&drop a blueprint based on that class in the scene, and press play. The scene capture component is located in the origin even if you placed the actor somewhere else.
Thank you for providing the additional information. I recreated the class that you provided, but did not see the results that you described. After creating the class and building the project in Visual Studio, I added an instance of the class into a level (version 4.7.2, built from source code) and was able to move the Scene Capture Component around the scene independently of the root Scene Component, and when I moved the root Scene Component the Scene Capture Component was also moved in relation to it. Are you seeing different behavior?
Ok, nevermind.
I guess i didn’t restart the editor after an hot-reload or something like that.
The funny thing is that i did tried multiple times to get it working with 4.7.2 and ended up setting the component location manually via blueprint. Today i tried re-enabling the old c++ code and it just works.