Smooth Top Down Movement

I’ve been working on trying to get character movement similar to that in the game Don’t Starve. So far the blueprint I have below works with moving the character, but he tends to be a little jumpy. Also he only moves when the left mouse is held down. I’ve also tried to do the movement using a timeline but this would cause the character to move very fast if the distance was long, and slower when it’s short.

Does anyone have any ideas on how to accomplish this, or any advice to at least point me in the right direction for more research? I know I could just use the character from the Top Down Template, but I’ve decided to try to implement things myself so I have a better understanding of what I’m doing.

Thanks!

Checkout the Top-down starter included in the engine. It does exactly what you are after.

The idea is to use the Movement component that is part of Character class. You can tell it to go to a particular location and it will navigate to that point. This will use the NavMesh for path finding.

However if you intend to do all the work yourselves, this is going to be a bit complex (if your level is not completely open and there are obstacles in it).

But if the level is completely open and you can get from any random point to any other random point in straight line, you can do this with some changes to your existing blueprint.

What you must do is calculate the distance from your current location o next target. Using this you can find how long it will take you to get there (Distance/Velocity). Use that time to interpolate your character’s location from Current to Target.This will make sure the character will maintain a constant velocity no matter the distance of target

The reason why you need to keep pressing the mouse button is because you are closing the Gate when you release the button.
In your MousePress event, simply store the location under cursor. Then move the Interpolation and SetLocation to the Tick event, pass the stored location as target to the Interp node.

Thanks for the response. I won’t be able to try this until I get off work later but I’ll let ya know how it goes. Is there a say to access the nav mesh in blueprints?

I’ve looked through the c++ of how they did it in the top down template and noticed that they got the navmesh and used that to check the distance when they moved. I wasn’t able to figure out how to access that in blueprints though.

Thanks again!

So I messed around doing it without a character and doing movement the way I had it in that blueprint and that want working out so nice. Ended up doing something similar to the top down template using c++.

Thanks again for your help man!

Hi Scnakmix,

I had a similar problem and made up a Blueprint only solution with works.

Hope this helps!