Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Speed = Dist / Time

Author
Message
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 19th Sep 2009 05:15
It's certainly a cool little Calculation to play with.
Yup just run this code, its really cool





To some this may seem like a dumb idea,because you can just use a speed variable then inc and dec as you need to, but think about it. The advantage lies in keeping the amount of distance you move the same. For instance, you could create a nice slow-Mo effect simply by changing Time#'s Value from 1 to 2. That would also work to create a fast-motion Effect by Changeing the value to 0.5. if you change this Time# varible to slow stuff down and speed things up, it makes it easy to maybe....slow all the bullets down in a matrix game, along with the player and everything else. All you'd have to do is declare a global Time# variable, and make sure that all the objects(bullets and stuff) are effected by it!


Uh-oh, i'm doing math. *Looks for latch*
.........Well for now, lets just say i'm correct with everything

Useful, eh?

Ch-Ch-CHEERS!
-DD

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Sep 2009 12:19 Edited at: 20th Sep 2009 12:23
Quote: ". All you'd have to do is declare a global Time# variable, and make sure that all the objects(bullets and stuff) are effected by it!"

Check out my bouncing clock entry for the first DBC challenge. I use a few simple physics equations and time is controlled how you are suggesting. By adjusting the time increment, the cubes stay in the air for longer or shorter periods of time.

Enjoy your day.
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 22nd Sep 2009 00:44
Hmmmm......hey latch, ive got a question.
You've got





and I've got



So, how are these two doing the same thing....? Plz keep in mind i'm horrible at math!

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Sep 2009 01:29
Take a look at the whole function. The function name is distance_2 which should give you a hint that it returns distance, not speed. S# in this case is displacement, or the distance as a result of a certain velocity maintained for a certain amount of time:



Some generic physics symbols are:
s = distance or displacement
v = velocity
a = acceleration
t = time

I'm not sure why I decided to to stick with the symbol 's' instead of just using a variable like dist# or distance# .

We can see that your equation and the one you posted of mine have the same roots if we juggle the equation around; we can get the same equation you posted:

If we divide both sides of the equation by time# we get:
s#/time# = velocity#

then switch 'em around
velocity#=s#/time#

I just have to comment that speed and velocity are almost the same thing, the difference is velcotiy has a direction (it's a vector) - it will be positive or negative. Speed is a scaler (it just has magnitude) and should always be positive. If it can be negative too, then it is a velocity. Confusing? Nahhh

Enjoy your day.
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 26th Sep 2009 03:47
Quote: "I just have to comment that speed and velocity are almost the same thing"

really? I'd thought they were totally differant. And yes, very confusing.......

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 27th Sep 2009 03:44
I think the difference between speed and velocity is that you have to have speed and direction to create velocity.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 27th Sep 2009 04:16
If you want some other velocity formulas, here are some physics based ones:

V=SQRT(Vo^2+2*a*(displacement))
Where Vo is the original speed, V is the new speed, a is the acceleration, and displacement is the displacement from its initial location

V=a*t+Vo

Self explanatory.

Note that these are single axis formulas, ie, you have to break your velocities into components. If you want more info on that, just ask.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 27th Sep 2009 05:23
am I right in thinking move object 1,-5 would mean the object has a speed of 5 and a velocity of -5.

TGC Forum - converting error messages into sarcasm since 2002.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Sep 2009 07:49 Edited at: 27th Sep 2009 07:50
Quote: "I think the difference between speed and velocity is that you have to have speed and direction to create velocity."

You would be correct.

Technically, speed is only a magnitude of velocity, while velocity would be a vector containing the direction of the speed.

Login to post a reply

Server time is: 2024-05-01 16:30:40
Your offset time is: 2024-05-01 16:30:40