Get the "Speed" of an object

Forum Home Forum Home > Construct 2 General > How do I....?
 Post Reply Post Reply
Author
1,296 Rep
Post Options Post Options   Quote 3DGS Quote  Post ReplyReply Direct Link To This Post Topic: Get the "Speed" of an object
    Posted: 03 Nov 2011 at 3:11pm
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
Back to Top
6,911 Rep
Post Options Post Options   Quote Wastrel Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 2011 at 4:46pm
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).
Back to Top
1,296 Rep
Post Options Post Options   Quote 3DGS Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 2011 at 7:14pm
thank you, that helps alot!
Back to Top
19,108 Rep
Post Options Post Options   Quote sqiddster Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 2011 at 8:04pm
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 ;) )

Back to Top
7,061 Rep
Post Options Post Options   Quote R0J0hound Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 2011 at 8:54pm
distance(0, 0, velocity_x, velocity_y)
will give you the speed.

angle(0, 0, velocity_x, velocity_y)
will give the direction.
Back to Top
6,911 Rep
Post Options Post Options   Quote Wastrel Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 2011 at 9:26pm
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
Back to Top
1,296 Rep
Post Options Post Options   Quote 3DGS Quote  Post ReplyReply Direct Link To This Post Posted: 04 Nov 2011 at 12:00pm
awesome thank you guys for the help i am really enjoying this program, and the community!
Back to Top
2,022 Rep
Post Options Post Options   Quote cymrix Quote  Post ReplyReply Direct Link To This Post Posted: 10 Aug 2012 at 5:10pm
This is exactly what I was looking for, thank you. I never thought of using velocity like that. Totally makes sense.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down