Fair enough… The problem is not WriteDataToDisk();
Your PController->ConsoleCommand(command, true); should output a log in the console. Can you check that log and see if the screenshot is taken multiple times. I hope the file name is part of the log.
Can you provide the type of delta_rotation and start_rotation. I suspect there is something wrong with your loop conditions. I would strongly suggest you use “while loop” if you are working with floating point number values.
Thank you for your suggestion.
The tutorial did not help directly, but it held a hint to an alternative solution using timers.
I am looking into that now as well.
So when I try it with a timer, all screenshots are taken except the first one.
Thus I do not think it is an override problem.
Your void UCaptureImageAngleData::CaptureData() is rotating the object and taking a screenshot. However, it is trying to do so in a single frame.
Put your PController->ConsoleCommand(command, true); in the Tick() of your Actor followed by your rotation but not in a loop. Tick() is executed before every frame so you will not need a loop. You will just need a variable to be able to stop it as it would otherwise fill your HDD with images. (be sure to stop it after several screenshots even if the angle is not reached)
If you do so you will loose the first frame because the order of operations is take screenshot → rotate → render and your first screenshot might not even have a rendered buffer to output. You might need to set your starting rotation one delta_rotation behind:
To avoid issues like this I would suggest you try this out entirely in the actor until you make it work and then separate the logic you want in a component. This is not an appropriate approach for very elaborate logic but since this is literally 10 lines you can test it in the actor.
Component is attached to the actor. Checked.
Actor’s tick enabled. Checked.
Thank you for the suggestion. But I did not know how to follow it accurately.
Instead I searched for my problem on the forum. I discovered that other people
had my problem (not ticking component) as well.
(UActorComponent not Ticking - Programming & Scripting - Unreal Engine Forums)
The solution was quite simple. Delete the component and attach it again, after this
the component ticked.
Following your advice on how to take the screenshots with the “TickComponent” function
everything went well. I just have to fix the first screenshot of the series.
Thank you for your endurance and precise instructions!
Hey dZh0, did you ever write an answer to this? I’m trying to take a series of screenshots, but without the quaternion rotation and just from a fixed angle above the object. I would like to take 1000. Thanks!