Get the "Speed" of an object

Get help using Construct 2

Post » 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

Post » 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
73
S
16
G
12
Posts: 320
Reputation: 11,549

Post » Thu Nov 03, 2011 7:14 pm

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

Post » 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
85
S
28
G
23
Posts: 3,141
Reputation: 31,125

Post » 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
50
S
7
G
7
Posts: 3,091
Reputation: 11,747

Post » 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
73
S
16
G
12
Posts: 320
Reputation: 11,549

Post » 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

Post » 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

Post » Thu Jun 05, 2014 9:57 am

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

Post » 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: 20
Reputation: 238

Next

Return to How do I....?

Who is online

Users browsing this forum: norab, ThunderLion and 2 guests