Move object to Player w/o navmesh (checked google)

Hi

I know this probably looks like I haven’t looked at all, but all of the answers I’ve seen refer to using Nav Mesh and the ones that don’t, I’ve copied the screenshots and I still can’t get to work.

I basically just need to test out a level whereby a simple object (cube mesh in this instance) is following the player (it will levitate so a NavMesh would be unnecessary). It would be as simple as "Event On Begin Play > (move towards Player Controller at x Speed).

Thanks

Hi DamianUnreal,

Not using a NavMesh means losing all its nice inherited features such as path planning and obstacle avoidance. Simple Move to Actor node you have in your Blueprints will only work for a pawn if and only if a NavMesh is present. However, if you don’t care about these features and you wanna create something like a flying minion that always follows your character, then you can have your actor move a straight line toward your character in a few ways:

If you created your actor blueprint based on a Pawn (i.e. it inherits from a Pawn), you can simply add a new component to it called FloatingPawnMovement, and then set it up as in the picture below.

The Nice thing about FloatingPawnMovement component is that it takes care of speed, acceleration and other kinematic stuff for you and you can simply tweak them to your liking.

However, if your actor is not inheriting from a Pawn, i.e. it’s based on an Actor class, then you would have to implement your own movement logic and also take care of any movement animation you have for your actor. Following picture illustrates a simple way of accomplishing this:

As you can see I had to check how close the cube is to my character to prevent it from running into the character and colliding with it. You can set the default values of the two parameters Acceptable Radius and Interpolation Speed to whatever value you like. Note that, in this case, your actor will follow a straight line towards your character based on this logic and might collide with obstacles or walls along the way (turn the Sweep on to detect collisions). If it’s a small flying minion then you might want to turn the collision off for it to prevent any weird colliding behavior. Otherwise, you would have to implement some kinda path planning and obstacle avoidance algorithm.

You can also add a little sinusoidal movement to the Y component of Direction Vector to have your cube go up and down to simulate some kinda floating movement effect.

The last thing to note for both of these scenarios is that I am getting my execution flow from the Event Tick node. Since these are constant smooth movement, It is necessary to have a tick event for such behaviors (whether the default tick method or binding a custom event to a clock that loops).

Hope these help.

Vizgin

You’re welcome. Please consider marking the question as SOLVED if your issue has been resolved to help people in referring to this answer and also better filter unanswered questions.

Hi Vizgin

Thank you for taking the time to answer my question in such detail. You covered everything. That’s perfect.