*UPDATED* Odd red lines when I move my object in play mode scene.

starfoxy

New member
Anyone ever seen this before? I am running AStar * Pathfinding with Behavior Designer and not sure which one might be causing this. Is this normal? I haven't seen this happen before. To describe it, there is a red line pointing up (Y) that follows the object when I move it and each lines appears and then disappears after a while as it follows the player. It almost looks like a raycast but I am not sure. There is nothing on my player object except for a simple movement script. (no AStar or Behaviors are on my player object - only on the object that seeks the player after 'seeing' it.)
 

Attachments

  • Capture - Copy.PNG
    Capture - Copy.PNG
    432.8 KB · Views: 4
I've drawn stuff like that in the past to debug but there shouldn't be anything within Behavior Designer itself that draws those lines. Are you sure it is coming from the behavior tree?
 
I am not 100% sure but it does only ever appear as soon as the tree 'Can See' task evals to true. Otherwise everything appears as normal. I will assume it's probably not a deeper issue than some visual weirdness but wanted to check in to see if I can fix it somehow.

I can say that this same thing did not appear to happen with the Polynav2D addon. I guess it should be said that it's probably not the addon for either asset (AStar Integration or Polynav Integration) as the seek behavior from both work fine.
 
Last edited:
Hmm. I don't believe I do. Draw Debug Ray is disabled on the Can See Object task. Is there somewhere else I should be disabling debugging?
 
That is the only location that Behavior Designer will draw the rays. Are you sure it is being drawn by Behavior Designer? Can you tell me how to reproduce from a fresh project?
 
I am going to test a few more cases and see what I can find out. Thanks again for your insights, I will report back.

**update**

Ok I have some news. If I write my own movement script for AStar Pathfinding Project and use it instead of behavior designer, there is no red line. This leads me to believe it may be something to do with the Movement Pack integration for AStar. I will test further and give an update.
 
Last edited:
I have discovered that this red line shown here is the same red line that appears on my player once 'seen'. I have an initial seek to point that gets updated once the player is 'seen'. Which means that once 'seen' evals to true, the path updates and of course moves the line from the original destination to my player. When I move my player around that line repeats itself over time, thus creating that duplicate line effect shown above. I am, however, still not 100% sure where that line is coming from. It shows even after disabling ALL gizmos in the editor.
 

Attachments

  • Capture_2---Copy.jpg
    Capture_2---Copy.jpg
    202.6 KB · Views: 3
That is likely something from A*. Behavior Designer does not draw any debug lines like that.
 
I finally found some time to dig into this further. The red line exists in the AStar Behavior Integration in:

\Assets\Behavior Designer Movement\Integrations\Astar Pathfinding Project\Tasks\IAstarAIMovement.cs

as follows:

C#:
protected override bool SetDestination(Vector3 target)
{
    agent.canSearch = true;
    agent.canMove = true;
    agent.destination = target;
    
    //this is the line that is calling that debug ray :)
    Debug.DrawRay(target, Vector3.up, Color.red, 3);
    
    
    return true;
}

I can comment out that line and this behavior ceases to happen. Is there another global way to disable all debug rays for behavior designer? I imagine there may be some performance hit with debug rays always being updated?
 
Good catch! It looks like that was accidentally left in there. I will remove it and update the integration.
 
Sounds great Justin, thanks! I do like the visual of where the new destination point is but perhaps having a toggle to enable/disable it might be cool? Really having fun with Behavior Designer. It's a joy to use. :)
 
Last edited:
Top