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"

Set a constant speed when button is held?

I want to recreate the boost function used in modern Sonic games (Unleashed, Colors, Generations, and Forces.) However, I'm only able to increase my maximum speed when holding a button, rather than that button press moving me at high speed by itself. I've tried adding movement input, but increasing the scale value doesn't put me at a high speed, it doesn't do much at all except move me an inch. Any way I can get this working?

Product Version: UE 4.14
Tags:
more ▼

asked Dec 11 '17 at 11:08 PM in Blueprint Scripting

avatar image

NikoPlymouth
1 2 1

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

4 answers: sort voted first

Play with Accelaration inside your Movement Component. Should do the trick.

more ▼

answered Dec 11 '17 at 11:13 PM

avatar image

Nachtmahr
7k 143 28 172

avatar image NikoPlymouth Dec 12 '17 at 02:59 AM

Not really sure what to do with any of it. I can get/set max acceleration, and get current accel, but I can't set it. I want the button to boost me forward and keep me running at a certain speed even without an input on the axis, but this just increases how fast I can go and how fast I can reach that speed if I have do input on the stick.

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

I'm not familiar with those games in particular but it seems like you want to press a button and have the player move forward at a higher speed for a given amount of time yes? I just tried using a timeline to push a value to add movement input node like there is on the thirdpersonBP and it seemed to work. I set the timeline to a value of 1 and a duration of 3 seconds.

alt text

boost.png (216.6 kB)
more ▼

answered Dec 13 '17 at 11:44 PM

avatar image

ThompsonN13
10.1k 33 10 25

avatar image NikoPlymouth Dec 14 '17 at 12:35 AM

Doesn't seem to be working the way I want it. It's slowly accelerating me up to the max speed, rather than putting me full blast into it right away.

avatar image ThompsonN13 Dec 14 '17 at 12:53 AM

i didn't use a curve in the timeline. I had two keyframes set to a value of 1 so it would immediately put you at full speed. The reason i used a timeline instead of just a straight value was to have the value applied over a time-span. you could use the update pin from the timeline node and a variable to achieve the same thing, i just used the value in a timeline track to make it simpler.

Edit: I just noticed there is a bit of ramp up with the example i gave but i believe its due to the max acceleration.

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

Try to unplug the timeline in the above example, and instead just plug in max speed variable into movement input, is it what you want to achieve? If you want a smooth transition, you can use timeline, just make it short, a fraction of a second.

more ▼

answered Dec 14 '17 at 12:42 AM

avatar image

Veseliy
111 1 3 7

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

I think the best way to achieve this is to set yourself the velocity you want your player to achieve. To do so, you can : 1) get your velocity from your Character Movement Componenent / or the direction of the player input, depending on your gameplay. 2) Normalize it so you keep the direction but the length is 1. 3) Multiply it by the speed you want to achieve, still keeping the direction but setting the speed of your boost. The speed is in cm/s. 4) setting the velocity on your character component.

Keep in mind that if the length of your velocity exceed your Max Walk Speed it will be clamped, so you may need to increase your max velocity for the duration of the boost. Tell me if this is working for you. :)

more ▼

answered Dec 14 '17 at 10:45 AM

avatar image

Sly.Sk
25 1 5 8

avatar image NikoPlymouth Mar 19 '18 at 12:26 AM

Sorry I took WAY too long to respond, I never had the chance. All that does is bump me forward a tiny bit on the ground, and send me soaring aimlessly. https://www.youtube.com/watch?v=apwvUCCvkVo Here's an example of what it is I'm trying to achieve, for reference.

avatar image Sly.Sk Mar 19 '18 at 09:17 AM

Hi Niko. Can you take a video or a gif of what you have ? It will be much simpler to see the issue.

(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