Use ALINE to visualize path

Hi there,

I just bought ALINE because Aron hinted at ALINE being one way to visualize the path (in game) that agents are taking.

The first roadblock I hit is that I have multiple cameras rendering the scene: There is one camera rendering the first person parts and one camera rendering the world. Both of which have different Field Of View, which means every line from ALINE is rendered 2x.

That’s not even the issue, but the issue has the same root cause: I actually want neither of these cameras to render the line, I only want a third camera, that is used for a render texture for a minimap, to actually render the line.

However I see now way to have ALINE create lines assigned to a layer, or to make a camera ignore lines generated by ALINE.

Does ALINE really not offer anything for that problem? That would mean the whole ingame-part is not very useful when working with multiple cameras/layers.

It appears the solution is to set the cameraTargets:

The documentation is a bit easy to misunderstand: Instead of using “Draw” (which is the static methods) it uses “draw” (which is the custome command builder).

I used “builder” instead of “draw” as a variable name. The following doesn’t render to my game cameras anymore. It doesn’t render to my minimap either, but I’m one step further.

        var builder = DrawingManager.GetBuilder();
        builder.cameraTargets = new Camera[] { ObjectInfo.GetMiniMapCamera() };

        DrawingManager.allowRenderToRenderTextures = true;

        using (builder.WithLineWidth(10f))
            using (builder.WithColor(Color.white))
                builder.Line(_endPoint.position, _endPoint.position + Vector3.forward * 10f);
                builder.Line(_endPoint.position, _endPoint.position + Vector3.right * 10f);

1 Like

And the coin dropped. You have to specify that you want to render ingame, when you get the reference to the builder.

        var builder = DrawingManager.GetBuilder(true);
1 Like