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.
asked Jul 23 '14 at 04:37 AM in Blueprint Scripting
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.
I had a similar problem and made up a Blueprint only solution with works.
Hope this helps!
answered Sep 14 '14 at 08:48 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here