# Obstacle between two points

Hello
Please help me how to find no of obstacles between two points. I was creation a building and i want to know the no f walls present between character and an actor. plzzz help…

You will have to perform line traces to check if there is something between point A and point B. The trace will stop at the first obstacle so you may want to perform another trace from that obstacle onward to point B again. There might be always some cases where traces are not the most adequate solution so it depends on your implementation and of course your use case and requirements.

Trace from A to B with obstacles in the middle, going from A to B we will find O1 and O2
in the path. So what we do is to do another trace from each hit to B again. It’s important
to temporally disable the trace response of the hit (O1 and O2) because if not you will get
that hit again (you can also ignore the actors by checking the ignore self box if the consequent traces use the hit as the trace actor). So you will end up with something like:

``````A ---> O1 ---> O2 ---> B
``````

I would suggest you to start playing around with line traces and multi line traces to see if it’s enough for you or not. Check out this wiki post about traces. Another type of traces that may fit your problem better would be a box shape trace.

Thanks for the reply… There are multiple obstacles between point A and B. We need to get details of all the obstacles. Plz help.

As I said you have to trace your way from point A to point B step by step to know if you will hit. You should also use one of the collision channels, that way you can fine tune what is meant to be an obstacle.

Both points A and B are not stationary. A is the character( First person player) and B is a material whose position will vary. We need to get details like number of walls between A and B.

so you need to trace and check what us between those points. You can not do that within a material, you have to process it outside, perform the traces through the trajectory, count the walls (or any other obstacle) and once you have reach the end use that value you incremented earlier. It does not matter if they are not stationary, you will just count hits.

Thank U…It Worked…

One more doubt…Is there anyway to find out the coordinates of Hit points (point on the obstacles that the trace line hits). Please help…

The hit point you will get from the trace contains a hit location and a hit normal, those should be enough.

Will we get hit location and hit normal of all obstacles present in between??

You will get a hit for every hit that your race will impact, so yes each hit contains all the info.

Thankzzzzz…it worked…Thanks alot…