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.

Dark Physics & Dark A.I. & Dark Dynamix / [Dark Physics] Vehicle Speed Calculation

Author
Message
Elite Gaming
20
Years of Service
User Offline
Joined: 10th May 2003
Location: Isle Of Wight, UK
Posted: 9th Aug 2006 21:44 Edited at: 9th Aug 2006 21:58
Hi all,

Just thought i'd ask a question about calculating the speed to which a vehicle is moving, using the vehicle physics code.

I know that speed = distance / time, but how would you go about using this in DarkBASIC?

Edit: Sorry i got that equation totally wrong! I want to know the instantaneous speed of an object, equation being:



or in written form: "The limit of the displacement divided by the change in time as the change in time approaches zero" or "the derivative of x with respect to t"

I've just had a really long day at work, so my brains not working properly, which is why i'm guessing the answer to the question is going to be really simple, and i'm going to feel really dumb!

Thanks!
Elite Gaming
20
Years of Service
User Offline
Joined: 10th May 2003
Location: Isle Of Wight, UK
Posted: 10th Aug 2006 02:59
Its alright now, my brains starting to work!



Needs a bit of tweeking, but seems to be calculating the speed correctly!
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 12th Aug 2006 15:29 Edited at: 12th Aug 2006 15:31
um.. that would be fine if your fps didn't change.. but it does so how about


remember this will be time in dbp units per millisecond
change
Speed#=distance#/(timer()-time#)
to
Speed#=1000.0*distance#/(timer()-time#)
for seconds

AMD athlon 64 3000+, 1GB ddr400, 400GB total hdd, ati radeon x700pro 256mb (pci-e) 17" tft(@1280x1024).

Login to post a reply

Server time is: 2024-03-28 13:21:29
Your offset time is: 2024-03-28 13:21:29