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
G
2
Posts: 62
Reputation: 1,546

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
72
S
16
G
12
Posts: 320
Reputation: 11,519

Post » Thu Nov 03, 2011 7:14 pm

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

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
81
S
27
G
21
Posts: 3,034
Reputation: 29,905

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
45
S
5
G
7
Posts: 2,788
Reputation: 10,810

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
72
S
16
G
12
Posts: 320
Reputation: 11,519

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
G
2
Posts: 62
Reputation: 1,546

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
17
G
3
Posts: 39
Reputation: 2,466

Post » Thu Jun 05, 2014 9:57 am

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


Return to How do I....?

Who is online

Users browsing this forum: Basen, cacotigon, cooltron, eli0s and 0 guests