# Get the "Speed" of an object

Get help using Construct 2

### » Thu Nov 03, 2011 3:11 pm

I am looking to get the speed of an object with physics being shot out of a cannon and cant seem to work it out, here is a capx of the general idea, any help would be greatly appreciated.

http://dl.dropbox.com/u/47975195/Speedofball.capx
B
15
S
1
G
2
Posts: 62
Reputation: 1,696

### » Thu Nov 03, 2011 4:46 pm

3DGS,

Speed = Distance/Time, so you need to determine the distance traveled by the cannon ball in a specific period of time, like every tick.

Here is a modified capx: http://dl.dropbox.com/u/38038537/Speedofball_modified.capx

This was just a quick and dirty example, and I'm sure there must be a more elegant solution (perhaps even built-in).
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

### » Thu Nov 03, 2011 7:14 pm

thank you, that helps alot!
B
15
S
1
G
2
Posts: 62
Reputation: 1,696

### » Thu Nov 03, 2011 8:04 pm

The physics expressions 'velocity x' and 'velocity y' are probably what you are looking for. I am not sure how to combine them to give you a good indication of actual velocity but it can't be that hard (most of the people hare are maths geniuses anyway ;) )

B
90
S
30
G
24
Posts: 3,189
Reputation: 32,440

### » Thu Nov 03, 2011 8:54 pm

distance(0, 0, velocity_x, velocity_y)
will give you the speed.

angle(0, 0, velocity_x, velocity_y)
will give the direction.
B
82
S
26
G
61
Posts: 4,822
Reputation: 44,684

### » Thu Nov 03, 2011 9:26 pm

See? I knew there would be a more elegant solution.

Here is the capx again, with R0J0's information:

http://dl.dropbox.com/u/38038537/Speedofball_modified.capx
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

### » Fri Nov 04, 2011 12:00 pm

awesome thank you guys for the help i am really enjoying this program, and the community!
B
15
S
1
G
2
Posts: 62
Reputation: 1,696

### » Fri Aug 10, 2012 5:10 pm

This is exactly what I was looking for, thank you. I never thought of using velocity like that. Totally makes sense.
B
16
S
1
G
3
Posts: 43
Reputation: 2,597

### » Thu Jun 05, 2014 9:57 am

The link doesn't work, can you replace it? thanks
B
5
Posts: 37
Reputation: 303

### » Tue Jun 30, 2015 11:23 am

Hi @Wastrel, can we get the working capx back, please? I'm looking for the same information and @markofb didn't alert you before, thanks in advance!
B
4
Posts: 34
Reputation: 266

Next