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"

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!

alt text

Product Version: Not Selected
Tags:
charactermove.png (213.2 kB)
more ▼

asked Jul 23 '14 at 04:37 AM in Blueprint Scripting

avatar image

Snackmix
43 2 5 11

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

2 answers: sort voted first

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.

more ▼

answered Jul 23 '14 at 05:00 AM

avatar image

mindfane
3.4k 154 52 272

avatar image Snackmix Jul 23 '14 at 06:48 AM

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!

avatar image Snackmix Jul 23 '14 at 11:38 PM

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!

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

Hi Scnakmix,

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

alt text

Hope this helps!

more ▼

answered Sep 14 '14 at 08:48 AM

avatar image

Purepower
56 1 104 10

(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