I added a teleport ability to middle mouse button and it works perfect… but it just ignores teleportation when trace line hits a foliage (trees)… my system is shown here (sorry for the low resoluton… but it’s not that hard to see it… is it? :D) :
it has to teleport to the end of line trace if there is no hit… but it counts hit as true when I middleclick to a foliage (trees) and doesn’t teleport there…
I just saw that it doesnt only happen in foliages… it happens in specific sides of everything… my house, trees, and other physical objects… I think my blueprint has the problem… but what’s it then
oh I just saw that but just realized that cast to my character is not neccessary… there is already a “self” written in there like I want when I break the link of cast to mycharacter… anyways it still does the problem… I dont say it never teleports… it just doesnt teleport to some specific points of objects and foliages… like in here:
can you update the image of your latest blueprint?
Assuming that you fixed the issue NichB mentioned, though, the other likely issue is that you are trying to teleport to the exact location of the collision. The Teleport command tests for collision, to make sure your object doesn’t end up embedded in geometry, so it’s very likely it is failing due to that.
check the output pin of the teleport command for the collide case - it is very likely false.
possible solution: instead of using the location as the teleport target, try hit->location + (hit->normal * a little more than the collision radius of your actor)
Note that this could happen in the no-collide path, too. Something just beyond your line trace could block the actual teleport, even though it didn’t hit the collision test. To solve that, instead of teleporting to hit->TraceEnd, teleport to (hit->TraceEnd - actor->ForwardVector * a little more than the collision radius of your actor)
you can extend your line trace distance by the ‘a little more than the collision radius of your actor’ if you want the exact teleport distance.
Thanks a lot for your help… I don’t know if I did the exact thing you said (my english tried hard… :D) but this worked pretty good if teleport fails, it teleports a little behind of the actual impact point… well, my way looks like the most poor and inefficent way… but it works
I don’t know the way to loop trying more backwards of the line trace… so if those 3 tries fail, say goodbye to your teleport for 1 sec (my teleportation has 1s delay)
hehe, yeah, that’s a little inefficient. Your additional line traces aren’t actually being used - you aren’t using whether anything was hit, or the impact point. What it ends up doing is essentially passing the ‘end’ input pin of the line trace to the ‘trace end’ output pin of the hit, and using that for the teleport. You could skip the the line trace and just directly hook that up to the teleport
to create the loop:
from the initial collision, store the hit->Location to a variable.
create a ‘for loop with break’ node. number of iterations can be whatever you like, but 3 is actually a reasonable number of attempts, so start index = 1, end index = 3 (or whatever you like)
int * float node (50 * for loop index)
vector * float node (forward vector * output of above)
vector - vector node (the hit->location variable you stored - output of above)
use the result of that as the teleport input location. if the teleport result is True, hook back around to the ‘break’ pin of the for loop, and it will won’t try any more.
the loop node’s completed pin will then execute (regardless of the teleport’s success). I would suggest setting a flag (boolean variable) after a successful teleport. If that is true, play the success sound. if false, play a fail sound (so the player at least gets some feedback if it doesn’t work)
but honestly, the loop code doesn’t help you much if you know you want to do the 3 attempts you’ve already got set up. Just remove the extra line tests, and it’s good.