Use LineTraceByChannel on difernt Actors?

Is it possible to use lineTraceByChannel on diferent actors?

i am doing an Archviz project an i want to slide doors only when i look at them inside a colision box, my problem is i only can do this with a single actor.

when i add diferent actors linebytrace stops working

Any solution??

Is it possible to use lineTraceByChannel on diferent actors?

The answer is yes, it’s possible. It’s somewhat hard to understand what is not working for you. Care to share more details?

an i want to slide doors only when i look at them inside a colision box

How does this bit work? Each door has its own overlapping collision volume; while the player is inside of it and is looking at the door, the door opens?

Any reason why you cannot simply reduce the length of the trace?

Thank you very much for helping me, i will share in detail my problem.

I created a sliding window actor that can only be activated when i am inside his colision box and at the same time i am looking at it.

The bluprint is this one:

My problem is when i create another actor i cant make it to work because i dont know how to cast linetraceByChannel to multiple actors.

Just need to know how to cast linetrace to diferent actors, i am using a frist person caracter.

Have a nice day

My problem is when i create another actor i cant make it to work because i dont know how to cast linetraceByChannel to multiple actors.

You have options:

  • use Inheritance:
    – implement functionality in the parent class, you will only need to cast to the parent class and all children will understand the function call.
  • use an Interface - this way you do not need to cast at all:
    – send a generic message target actors can interpret. Especially useful when actors that do not share functionality - like a Tree and a Door - they have little in common. An interface would allow you to send the same message to both.

ok so insted of casting to a specific actor if i use an interface all actors will understand even if they do diferent things like sliding door and a opening rotating one?

Precisely. Each actor can decide for themselves what that generic message means to them.

  • if you look at a tree, it will shake
  • if you look at the door, it will open
  • if you look at the bucket, you kick it

shake / open / kick functionality would be implemented in the actor itself.


  • create the interface in the content browser:

image

  • open it and add a function:

image

  • in the Door / Window actor (any actor that needs it), add the Interface:

And then implement desired functionality.

  • when you line trace:

1 Like

Thank you very much, i will study this subject further and test it.

You have been very helpful, thank you for sharing your knowledge.

Have i nice day :slight_smile: