Download

Line Tracing help to blueprint

Here’s my progress but i think i need help or a different way of doing this. I want to trace towards the nearest blueprint in my level (acting as a volume over a wall for wallrunning) to my players local location and rotation, and depending on weather or not its on the left of right side of player - do something different for each.
I don’t think the current line trace will help much as its just set to static world meshes which makes me think there is a better way of doing this because this doesn’t work haha
Thanks

Still stuck with this :frowning:

Hi Twibbz,

I’m not 100% sure on what the end goal is here, but it looks like your trace endpoint is going to end up near (10,10,10) in world space, which I expect isn’t what you’re looking for.

Try setting your DrawDebugType to visualize your traces. The BP debugger should also be helpful in instances like this by letting you pause execution and verify the values you are getting are what you expect.

I’ve basically got a rough wall running mechanic going, where the camera tilts at a 35 degree angle to the right when jumping against my blueprint wall. This camera tilt is great whilst running with the wall to my left, but as soon as i wallrun from the other direction it obviously needs to rotate the other angle. So i thought i should define this by finding weather or not the blueprint wall was to the players local left or right then execute the right camera tilt.
Hope this makes more sense

Yeah, that makes sense. Sounds like you want your trace endpoint to look something like

TraceStart + GetControlRotation().GetRightVector() * 10.0

which basically means “10 units to the control rotation’s right of TraceStart”. You probably want more than 10 though, since Unreal units are centimeters by default (unless you changed this).

Hope that helps!

Hey Twibbz!

Yes you do indeed need to Multiply by a Right vector and then Add that to the Location of your pawn.

Why **Multiply **and not Add?
Let’s say that you get the Up vector from your actor using a “Get Actor Up Vector” node, and that the return vector is (1,0,0)
If you Add 10 to each element the resulting vector will be (11,10,10), but that’s not what you want,
However, if you Multiply by 10 then the resulting vector will be (10,0,0) - Great! that’s what is needed.

Then you “add” that resulting vector to the Location of your actor.

Why **Add **and not Multiply?
Let’s say that your actor is at position (3, 10, 55) in world space,
if you Multiply that by the resulting vector you’ll get to (30,10,55), that’s usually not what you want.
if you Add instead then the vector will be at (13,10,55), Great! we can now trace 10 units above the actors location!

The same principle applies to the Right vector which you can get by using a Get Actor Right Vector node.

I just made an example of detecting a wall on the right and left side of the player - in another thread.
I modified it a little to simplify things, have a look:

http://imageupper.com/s02/1/8/Z1398292434643198_1.png

You can replicate it by making a function called **DetectWall **( I named mine DetectWallTwibbz because I have another function with the same name).
The function has 2 output parameters: HitWall and Right, both are booleans.

Notice the Sequence node,
it fires twice into the Line Trace node,
this way we don’t need two of the same nodes!

The **amount **variable is basically the length of the Trace,
if you want to trace further into the world then increase that number.

To make use of the function is pretty simple, it can be done like so:

http://imageupper.com/s02/1/8/Z1398292434643198_2.png

Hope this helps! :smiley: