How to measure velocity?

Get help using Construct 2

Post » Wed Oct 21, 2015 5:05 pm

How to measure velocity of an object and than put the velocity value into a text object? Just like it's done car games.
*misses old games*
B
20
S
4
G
4
Posts: 147
Reputation: 3,193

Post » Wed Oct 21, 2015 5:12 pm

Are you using a behaviour for the movement?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Oct 21, 2015 5:14 pm

In physics, velocity, which is the rate of change of position (or speed in a particular direction), is a vector. Imagine that you just hit a ground ball on the baseball diamond and you’re running along the first-base line, or the s vector, 90 feet at a 45-degree angle to the positive x-axis. But as you run, it occurs to you to ask, “Will my velocity enable me to evade the first baseman?” A good question, because the ball is on its way from the shortstop.

Whipping out your calculator, you figure that you need 3.0 seconds to reach first base from home plate; so what’s your velocity? To find your velocity, you quickly divide the s vector by the time it takes to reach first base
Image
This expression represents a displacement vector divided by a time, and time is just a scalar. The result must be a vector, too. And it is: velocity, or v:
Image

Your velocity is 30 feet/second at 45 degrees, and it’s a vector, v.

Dividing a vector by a scalar gives you a vector with potentially different units and the same direction.

In this case, you see that dividing a displacement vector, s, by a time gives you a velocity vector, v. It has the same magnitude as when you divided a distance by a time, but now you see a direction associated with it as well, because the displacement, s, is a vector.


Or you can just use 8 direction Behavior and get the speed , I think platform behavior and car have it too. Physics objects let you check the velocity, and bullet lets you check speed in Pixels per second too.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Wed Oct 21, 2015 6:27 pm

I studied physics for 4 years mate, I know how to calculate velocity :P
I already have 8 direction behavior so I can't use any others.
*misses old games*
B
20
S
4
G
4
Posts: 147
Reputation: 3,193

Post » Wed Oct 21, 2015 6:35 pm

Like it says in the Manual on 8 direction

the expression self.8direction.speed will give you the current objects speed in pixels per second..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Oct 21, 2015 6:52 pm

Thanks I did it. I'll read the manual good through these days. I did read some of it before, but only when I needed something specific.
*misses old games*
B
20
S
4
G
4
Posts: 147
Reputation: 3,193

Post » Wed Oct 21, 2015 7:11 pm

DeRock wrote:I studied physics for 4 years mate, I know how to calculate velocity :P
I already have 8 direction behavior so I can't use any others.



The second answer i gave lets you know that the Physics behavior has the Velocity. You can get the speed from the 8 direction movement, but not the Velocity, it is speed in pixes per second IIRC.

So to use the 8 Direction , and get the velocity, you are going to have to put your extensive physics training to work :). First you will need to determine your scale though.

Have a nice day :)
B
29
S
8
G
4
Posts: 767
Reputation: 5,985


Return to How do I....?

Who is online

Users browsing this forum: brandonP and 21 guests