Description
The RenderToVideo
method is a static extension method provided by the SandboxToolExtensions
class. It allows you to render the current view from a SceneCamera
to a video file using a VideoWriter
. This method is useful for capturing video footage of a scene in the Sandbox environment.
Usage
To use the RenderToVideo
method, you need to have a SceneCamera
instance and a VideoWriter
instance. Optionally, you can specify a TimeSpan
to determine the duration of the video capture. If the time
parameter is null
, the method will capture video until manually stopped.
Here is how you can use the method:
- Ensure you have a valid
SceneCamera
and VideoWriter
set up.
- Call the
RenderToVideo
method with the required parameters.
- Check the returned boolean value to determine if the rendering was successful.
Example
// Example usage of RenderToVideo
SceneCamera camera = new SceneCamera();
VideoWriter videoWriter = new VideoWriter("output.mp4");
TimeSpan? duration = TimeSpan.FromSeconds(10);
bool success = SandboxToolExtensions.RenderToVideo(camera, videoWriter, duration);
if (success)
{
// Video rendering started successfully
}
else
{
// Handle failure to start video rendering
}