Vectrosity Render to Multiple Cameras

I have a project with a split screen view. One camera is from a top down perspective while the other is from the side. I want to see my Vectrosity lines from both cameras. As it is now, one camera has the lines correct and the other sees them askew.

I found this old post and tried to set the camera in OnPreRender(). But that didn’t make a difference.

Is there a way to achieve this with Vectrosity?

I am using two orthographic cameras. I tried the same with perspective cameras and did not see a difference in behavior.

Here is simplified version of what I have:

var positionBuffer = new List<Vector3>();

// Some code that fills the positionBuffer with data

var shotLine = new VectorLine("ShotLine", positionBuffer, 4.0f, LineType.Continuous);



Yes, it is possible to render Vectrosity lines to multiple cameras in Unity. To do this, you will need to use the VectorLine.SetCamera() method to specify which camera the lines should be rendered to. You can then call this method for each camera that you want to render the lines to, passing in the appropriate Camera object as the argument.

For example, if you have two cameras, camera1 and camera2, you could do something like this:

VectorLine.DrawLine(…); // draw the line for camera1

VectorLine.DrawLine(…); // draw the same line for camera2

This will render the Vectrosity lines to both cameras, allowing you to see them from both perspectives.

Note that this method only works for cameras that are rendering in perspective mode (not orthographic mode). Additionally, if you are using multiple cameras to render a split-screen view, you may need to adjust the viewport settings of the cameras to ensure that they are rendering to the correct portion of the screen.

I hope this helps! Let me know if you have any other questions.

Yes, you can use the SetCamera() method on your Vectrosity line object to set the camera that will be used to render the line. This will allow each camera to render the line correctly from its perspective.

Here is an example:

// Set up Vectrosity line
VectorLine line = new VectorLine("Line", new List<Vector3>(), null, 2.0f);

// Add points to line
line.points3.Add(new Vector3(0, 0, 0));
line.points3.Add(new Vector3(10, 10, 0));

// Draw line

// Set camera for side view and draw line again

This will create a Vectrosity line that is correctly rendered from both the top down and side cameras.