Announcement

Collapse
No announcement yet.

Instanced based Line Trace

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

    Instanced based Line Trace

    I tried looking for this on the forum and couldn't find it anywhere. I have my line trace on a controller BP and it's set to an initial length of 1500 uu. How would you go about setting up the line trace to be instanced based per actor you want a hit result with? Meaning, as an example, have one BP with a line trace length of 50 uu (only interact / get a result at this length) and another BP with a trace length of 15 uu (only interact / get a result at this length), but not affect the trace length globally? Thank you in advance!

    #2
    Let me see if I understand:

    You have Actor A, who creates a linetrace length 1500uu.
    Actor A can interact with Actor B, only if it's at <= than 50uu from A.
    Actor A can interact with Actor C, only if it's at <= than 15uu from A.

    Is this what you want?
    "I have harnessed the shadows that stride from world to world to sow death and madness."

    Comment


      #3
      Sorry if I was not clear enough but, yes that is what I was looking for. I'm setting up interactables and want to change the distance at which you can interact with them.

      Comment


        #4
        There are many ways to do it.

        Here is a way to do it with interfaces:

        Create an interface "Interactable" with one input: "Distance":

        Click image for larger version  Name:	1.png Views:	1 Size:	125.2 KB ID:	1650549

        Every actor that can be interact, will implement this interface, with a simple branch on the minimum interaction distance for this particular actor (or implement a parent interactable actor, and all you need is to set the distance for each one):

        Click image for larger version  Name:	2a.png Views:	1 Size:	13.5 KB ID:	1650550

        Click image for larger version  Name:	2b.png Views:	1 Size:	223.7 KB ID:	1650551

        In the linetrace creator, you call the interface, feeding the distance from the hit result:

        Click image for larger version  Name:	3.png Views:	1 Size:	104.8 KB ID:	1650552
        Last edited by EvilCleric; 08-06-2019, 11:44 PM.
        "I have harnessed the shadows that stride from world to world to sow death and madness."

        Comment


          #5
          Ok, it seems to be working. I just need to tweak it a bit. Thanks a bunch!
          Another question, if you don't mind, how would I stop interaction? Lol. I have a draw-able render target that I can activate when at a specific distance now but, after it's activated it stays activated and I can draw on it at 1500 uu away when it's set to 150 uu. Is there a node to cease or stop or something similar?

          Comment


            #6
            This is how I have the BP set up currently. Initial activation distance is fine. It's just registering the BP as still being activated.

            Comment


              #7
              When the distance is higher than "interact distance", the branch should be false, and the input disabled.

              Comment


                #8
                The distance at which I can interact with the object and 'activate' it with E is not a problem. The problem is, after I press E, it remains 'activated' and I can still draw on it from a further distance than which I have set. If I press E a second time, it 'deactivates' the object and I can no longer interact with it. I want it to be as soon as I am not looking at it anymore, I have to reactivate the object.

                Comment


                  #9
                  How are you detecting the distance? Are you calculating the distance every tick or every n frames? Need to see the activation's BP.
                  Last edited by EvilCleric; 08-08-2019, 12:31 AM.
                  "I have harnessed the shadows that stride from world to world to sow death and madness."

                  Comment


                    #10
                    I have passed the distance from my controller into an interact BP event. I am using a timer set by an event that is set to looping to calculate the line trace.

                    Comment

                    Working...
                    X