Can a line trace run short of it's target?

Is it possible to make a line trace from one object to another stop before it reaches that object but remains on the same line at all times?

I need a line trace to hit an object, then readjust it’s length so it won’t hit that target again, but keeps pointing at the same point. Is there by any chance a simple way to do this? Normally I’d just make it ignore that object to stop generating hits, but that won’t be possible in this case.

For some reason, I always seem to come up with a solution within 30 minutes of posting any kind of question here after being stuck on it for ages. What I needed to do was to get a 1,0,0 vector, rotate it by the look at rotation of the source to the target, then find the distance between the two objects, subtract the amount I wanted to be short of the target, multiply my rotated 1,0,0 vector and add that to the source coordinates. Like this:

and I can just promote the distance I want to come short to a variable and change that during runtime.

I honestly can’t understand even after looking at ure bp how to shorten the trace for my teleport bp with 30-50 cm.

Maybe this is less confusing: You need to get the distance between the two locations and a direction vector from start to end. You then subtract a little from the original distance, so it doesn’t quite reach the end distance wise. You then multiply your rotation vector (which is a unit vector showing only which way to go) with the new distance to get a trace in the correct direction. And then you add your whole thing to the start location so it knows to start the new trace at the correct location.

1 Like

Omg thank you so much. After so many tried I got working! The only difference I had to do is all this math after the break hit result. Since I still need the trace to be as it’s supposed to be, but after it hits I need that location closer.

http://puu.sh/oUthM/039fec1cc9.png

For future reference, you can click on the “add new comment” button to reply to messages instead of posting an “answer” when you want to reply to someone. Helps keep the conversations in one stack on questions that have multiple potential answers. :slight_smile: