x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to safely teleport on NavMesh

I'm trying to implement a "Blink" teleport. Which moves the player x metres forwards. I thought this would be simple, as I've implemented it in Unity. However I'm getting issues where either the player falls through the landscape or is unable to move afterwards.

I've tried all sorts of combinations of SweepMulti, NavigationRaycast, ProjectPointToNavigation, FindPathSync (to get a path end point to the location instead; didn't work), GetRandomPointInRadius (with a low radius), SetActorLocation and Teleport.

The issue almost always occurs when the teleport hits a wall (landscape), I find a point using combinations of the above to ensure it's a valid navigatable point, and also adjust the position to be 2m away from the wall (which prevents most fall-through), but still it gets stuck all the time. Like it's half-on the NavMesh.

In Unity I achieved the same by using raycasts and NavMesh.SamplePosition and never experienced this problem. I thought ProjectPointToNavigation was the equivalent but perhaps I'm wrong. Still learning!

Thanks in advance

Product Version: Not Selected
Tags:
more ▼

asked May 03 '14 at 05:21 PM in C++ Programming

avatar image

DannRees
245 18 30 40

avatar image jwfitt May 09 '14 at 10:01 PM

Also running into a problem with a teleporting actor falling through the world (NavMesh).

avatar image MarkcusD Mar 25 '16 at 07:13 PM

Did anyone figure this out?

avatar image VincentJun Mar 31 '17 at 11:41 AM

would you mind share your solution? when i teleport to target my character always through the floor .............

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I've made the same sort of mechanic work multiple times. If you are manually adjusting the endpoint to make sure you won't teleport halfway inside the level geometry, it should work fine. The adjustment is the tricky part, so make sure you're doing that correctly.

If you're snapping your endpoint to the navmesh, then note that the navmesh is super close to the ground- and sometimes slightly under it- and your character's location is usually at their center. So by teleporting to a point directly on the navmesh you're probably teleporting them halfway into the ground, which is why they're falling through. You need to teleport above the navmesh.

The full steps for what you're trying to do would be:
1. Calculate a position x units forward from your character.
2. Project that location to the navmesh. (find closest walkable area)
3. Raise that point up a moderate amount, say 50cm. (handle case where navmesh is slightly underground)
4. From the previous point, raycast downwards. (find exact location of the ground)
5. Add your character's half height to the hit location to get your final teleport point. (adjust for character height)
6. Set the character's location to that teleport point.

This method is one of the simplest ways to achieve the effect, but some games might not work with the limitation of only being to teleport where the navmesh is. In that case, I hope you're good at geometry.

more ▼

answered Oct 20 '17 at 04:29 AM

avatar image

ncurtis
66 1 6 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question