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).
B
63
S
13
G
11
Posts: 307
Reputation: 10,893

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
68
S
23
G
17
Posts: 2,674
Reputation: 26,406

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
36
S
3
G
6
Posts: 2,154
Reputation: 8,576

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
B
63
S
13
G
11
Posts: 307
Reputation: 10,893

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
13
G
3
Posts: 38
Reputation: 2,185


Return to How do I....?

Who is online

Users browsing this forum: FrancoAflalo, gamarros, plikrus, skozax, Snowmane, vnHarry and 3 guests