Creating a Warp/Blink effect.

I’m currently looking to create a warp/blink effect along the lines of Whirlwind Sprint from Skyrim, or the Mage’s Blink from World of Warcraft. In both cases, the character moves along the landscape (i.e. warps uphill if facing into a hill and downhill if facing down a hill). I have not come up with a method that does this, and I’m out of ideas…

What I have tried:
Adding an impulse force (Launch Character or Add Force). On a semi level surface this is fine. Looking downhill, the character gets launched across the level, and up hill it just collides with the hill and stops.

Manually moving the character (Teleport To or Set Actor Location), which again works on level surfaces, but throws the character in mid-air looking downhill, or into the hill looking up hill. Part of my problem with this approach is that I’ve been unable to accurately find the Z coordinate of the target location (I’ve tried using traces against the landscape/level meshes, but have had no luck).

Anyone have any ideas/thoughts on how this might be done? I prefer code, but if it needs to be Blueprint, that is fine too.
Currently using 4.6.1 until our demo is complete.

Thanks!

You could try a nav mesh. The SillyGeo demo uses a Nav mesh for bounds on spawning its enemies, but doesnt actually use it for the AI.

So you could create a nav mesh and check that the teleport area is within a valid spot within the mesh. UE4’s Nav meshes are nice in calculating walkable areas, so should be perfect for getting your character to tp to the correct spot, but on the ground and not in a hill.

You’ll have to most likely manually set the players view however.

I actually already have a NavMesh for AI use; I’ll have to give that a look. Thanks for the suggestion.

Well you can use the Teleport method, but you just need to run some Line Traces before hand to calculate collision, then use the HitResult.Location of that trace to modify where you’re setting the warp to.

I believe you can access this using


GetWorld()->LineTraceSingle()

. SetLocation also has a bSweep variable, setting that to true can prevent it from spawning in the middle of things. But I’ve also noticed it causes crashes if it’s used rapidly (like a Tick() or a Loop).

Anytime. As some more info, in the BP in SillyGeo, he has his NavMesh then uses a GetRandomPoint function on the Nav System to get his point.

However, you could use some of the other functions available in the UNavigationSystem. One that stands out that may be useful for you:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/AI/Navigation/UNavigationSystem/FindPathToLocati-/index.html

More info on UNavigationSystem:
https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/AI/Navigation/UNavigationSystem/index.html