static bool RenderToVideo( SceneCamera camera, VideoWriter videoWriter, System.Nullable<System.TimeSpan> time )

robot_2Generated
code_blocksInput

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:

  1. Ensure you have a valid SceneCamera and VideoWriter set up.
  2. Call the RenderToVideo method with the required parameters.
  3. 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
}