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"

Measuring speed correctly

![alt text][1]

Hey all! I'm trying to measure speed, but this current blueprint setup does not work. I checked out my velocity, and it goes all over the place, so now i'm trying to figure out how to measure speed correctly. Any ideas? Thanks [1]: /storage/temp/251112-oh-no-accel.png

Product Version: Epic Games Launcher
Tags:
oh-no-accel.png (227.4 kB)
more ▼

asked Aug 21 '18 at 12:43 AM in Blueprint Scripting

avatar image

The Bonk Batter
45 1 1 7

avatar image Tuerer Aug 21 '18 at 05:16 AM

What about that Set Max Acceleration, doesn't it have to be hooked up to something?

avatar image The Bonk Batter Aug 21 '18 at 05:29 AM

Probably. But neither it or the particle works. I need a way to measure speed that does not involve velocity, thats all.

avatar image Tuerer Aug 21 '18 at 06:16 AM

Did you set the correct Max Speed for your character? I don't know about all the templates, but in 1st Person it's about 400, if I remember it right, and if it is, your speed will be <100 for about 0.1 seconds maybe.
Set Event Tick to display your velocity vector length for you every frame. You'll see what it is in dynamics.

avatar image The Bonk Batter Aug 21 '18 at 11:12 PM

Erm, Max speed is around 4000. So thats annoying. But the main point of this is that if i walk south, my velocity goes negative and such. So how would i fix that? Thanks

avatar image Tuerer Aug 22 '18 at 04:14 AM

Velocity might be negative, but vector length will always be positive regardless. So that's not an issue.
What I meant under Max Speed is this: how long is your speed less than 100 when you start moving? If you have, for instance, a spaceship or something similar that starts really slow and gradually gains speed to be really fast, maybe you should set the initial Max Speed to much lower values, like 20 or something, and gradually increase it after movement starts.
The same example with the 1st Person template: Max Walk Speed is 400, and the character gets to this speed in around 0.2 seconds, and in my case the character speed is under 100 for only 4 ticks; and if you want to be able to see your particles, that time should be longer.
Anyway, your speed measurement itself is correct. If you don't get the result you want, something else must be wrong.

avatar image The Bonk Batter Aug 22 '18 at 04:26 AM

Hm, that would make more sense. I'll try upping the value, then.

avatar image The Bonk Batter Aug 22 '18 at 04:29 AM

Okay, 1400 speed, it takes around 4 seconds to get there, yet particles arent disappearing and i cant notice any dramatic slowdown.

avatar image Tuerer Aug 22 '18 at 05:00 AM

How is your Slow Startup invoked? Every tick or something like that?
What happens if you manually disable your particle system, with a key press or something?

avatar image The Bonk Batter Aug 22 '18 at 05:37 AM

I forgot to hook it up, but now it's hooked up to event tick. https://youtu.be/AKQoyDlSRfc but now, erm.. You can see the slow startup/particles are a little... Uh, 'funky'

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

1 answer: sort voted first

You can get the characters speed by using the

Get Velocity -> Vector Length

If you are having issues with negative numbers you can run it through an absolute function

ABS

more ▼

answered Aug 22 '18 at 01:51 AM

avatar image

xXZUKINIXx
116 4 5 8

avatar image The Bonk Batter Aug 22 '18 at 02:55 AM

https://youtu.be/cmgMhLHANrs As you can see here, It just goes negative If i go south. Will absolute functions fix this?

avatar image xXZUKINIXx Aug 22 '18 at 03:07 AM

The Absolute function should fix it.

Getting the characters speed is shown above. Once you get that float value you can do what ever you want with it.

Running it through the Absolute function guarantees it is always a positive number.

avatar image The Bonk Batter Aug 22 '18 at 04:13 AM

![alt text][1]

I hoped it would work, but I can't tell. Nothing prints, No particle disabling or speed changes. Did i mess something up (again) [1]: /storage/temp/251236-print.png

print.png (294.5 kB)
avatar image xXZUKINIXx Aug 22 '18 at 12:00 PM

You would need to debug your code and find out why it is not printing. However for debugging purposes just create an event like this one and put it after the Event Tick. This will at least show you what variables you are going to receive.

Then you can debug your code and find out why it is never getting to the Print section alt text

show-speed.png (88.0 kB)
avatar image The Bonk Batter Aug 22 '18 at 09:51 PM

It works, but strangley velocity only gets higher then 0 when i jump. Walking around just makes it 0.10040~ ish

avatar image xXZUKINIXx Aug 23 '18 at 12:20 AM

Did you make any modifications to the Movement Controller or doing anything else with velocity. I wouldn't know why that would be happening.

avatar image The Bonk Batter Aug 23 '18 at 01:44 AM

I don't think so.. I only measured it. I'm really confused.

avatar image The Bonk Batter Aug 23 '18 at 05:17 AM

One possible fix is to have two conditions: Its higher then 0, but lower then 100. Maybe?

avatar image The Bonk Batter Aug 25 '18 at 01:33 AM

Still barley works, 1 < and 0.02 > works somewhat but its still pretty messed up. I could send you the project file if you want, so you can have a look at whats wrong

(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