Announcement

Collapse
No announcement yet.

DrawDebugHelpers.h outdated? Persistent lines not working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    DrawDebugHelpers.h outdated? Persistent lines not working

    Hello,

    for an assignment I want to create custom collision detection, and to create my own AABB implementation I've been trying to look into the DrawDebugHelpers.h to visualize the box.
    However, the class seems outdated as it does not look like the bool bPersistentLines does anything. The Lifetime attribute of -1 doesn't do anything, either.

    The drawn lines disappear after about a second.

    This is the code I used. Both lines do not work for more than a second. Setting a breakpoint in FlushPersistentDebugLines did not seem to work either. Is there any alternative or a confirmation that this is outdated?

    #2
    They should work. They are exposed to blueprint in KismetSystemLibrary and using them regularly (DrawDebugArrow). Never tried bPersistent but setting the time works,
    NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

    Comment


      #3
      Setting the time only works for natural numbers, really. -1 or 0 do not set the duration to infinite. Those will just make the body disappear very quickly. I just tried it via KismetSystemLibrary in blueprints, too. There surely has to be a way to properly draw permanent primitive bodies into the scene...

      Comment


        #4
        Why not set it to an extreme high time value? Keep in mind that stuff is debug and probably will not work in packaged game. So do not design your world with it.
        NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

        Comment


          #5
          Because I want to do my assignment in a more proper way. Rendering AABBs for visualization (so, not really necessary in shipped builds either) should not have a timebomb attached to it.
          I mean, you are right that assigning a high duration would serve well enough for now, but if there is a bPersistent attribute to rendering those primitives, it should work as intended. Currently, it does not.

          Comment


            #6
            Originally posted by Quexlaw View Post
            Because I want to do my assignment in a more proper way. Rendering AABBs for visualization (so, not really necessary in shipped builds either) should not have a timebomb attached to it.
            I mean, you are right that assigning a high duration would serve well enough for now, but if there is a bPersistent attribute to rendering those primitives, it should work as intended. Currently, it does not.
            I for sure prefer the proper way as well, but it feels like I need to workaround things every day, ...

            If you look into the executed functions, you find that you need to set DepthPriority to SDPG_Foreground for it to work.
            NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

            Comment


              #7
              Draw them in actor or component Tick() and they work. No parameters for persistent or lifetime.
              Last edited by Shmoopy1701; 10-15-2018, 11:58 AM. Reason: clarification

              Comment


                #8
                Originally posted by Jocko Jonson View Post
                Draw them in actor or component Tick() and they work. No parameters for persistent or lifetime.
                No parameters for persistent or lifetime just means persistent set to false and lifetime set to -1, which will render for a frame (I guess, a very short time). Drawing them in tick means drawing a new one each frame. Seems bad..
                Originally posted by Rumbleball View Post

                I for sure prefer the proper way as well, but it feels like I need to workaround things every day, ...

                If you look into the executed functions, you find that you need to set DepthPriority to SDPG_Foreground for it to work.
                Does this fix the lifetime? If so, that would be.. interesting. I will have to try this out later. If not, I will just look into FPrimitiveSceneProxy, as it looks like this is used to render the existing sphere-,boxcomponents etc.



                Comment


                  #9
                  Originally posted by Quexlaw View Post


                  Does this fix the lifetime? If so, that would be.. interesting. I will have to try this out later. If not, I will just look into FPrimitiveSceneProxy, as it looks like this is used to render the existing sphere-,boxcomponents etc.


                  Did not try it, but should work.
                  Open the DrawDebug... function and have a look youself
                  NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

                  Comment


                    #10
                    Originally posted by Quexlaw View Post
                    No parameters for persistent or lifetime just means persistent set to false and lifetime set to -1, which will render for a frame (I guess, a very short time). Drawing them in tick means drawing a new one each frame. Seems bad..
                    Everything gets drawn every frame anyway ... Also any moving objects will have to update the lines vertices every frame.
                    Last edited by Shmoopy1701; 10-16-2018, 01:26 PM.

                    Comment


                      #11
                      There's indeed a bug here. The persistent bool is used to pick whether to use LineBatcher or PersistentLineBatcher from the current world. Then, it adds the lines with a default lifetime of 1 second. Both line batcher components are ticked every frame, and decrement the remaining time of each line until zero, then remove them.

                      So making your lines persistent actually had no effect. Great!

                      There are 2 simple ways to fix/ work around this:
                      1) Set your lines to very high lifetime. This makes it still waste cycles decrementing all the life times though.
                      2) Turn off the component tick on World->PersistentLineBatcher. You can do this from anywhere in your code, or put it in a fitting engine method (like UWorld::UpdateWorldComponents).

                      Comment

                      Working...
                      X