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 / Physics in DBC

Author
Message
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Oct 2009 01:36
I volunteered to write the physics for the DBC Pros/DADWNN/Dark Basic Classic Conservation Society (ooh I actually like that one, all stately sounding) project, but then I realised I'm pretty rusty with my physics and even after refreshing my memory I still don't know where to start.

I assume everything needs a mass for calculating acceleration.
And everything will need x,y and z velocities.
The trouble is when I sat down to code this I didn't really know how to go about it. How should I store these values? What happens if an object changes direction?

I'm sure I can get this done with some help, but if it is just as hard to explain as to code then maybe I should do something else for the team.

Thanks in advance...

TGC Forum - converting error messages into sarcasm since 2002.
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 24th Oct 2009 03:27
Quote: "And everything will need x,y and z velocities."

xD.

Quote: " How should I store these values? "

Arrays. Maybe somthing like



As for if an object changes direction, your on your own.
maybe try



Good luck tho, i'd love to see this...

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
No Time To Code
15
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 24th Oct 2009 20:16
Quote: "Rem Actually nah, i got nothin...."

LOL, that's just wrong!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Oct 2009 22:43
You would need force generators. Things that will generate a force, which can then be converted into an acceleration for each object (F=m*a). Remember it needs to be in x,y, and z components. You can then add the accelerations to each object affected by the force.

These equations might help (note that these assume constant acceleration, such as gravity and such).

S=1/2*a*t^2+Vo*t+So
Where a=acceleration, t=time, Vo=initial velocity, S and So=Displacement and initial displacement, respectively.

Vf^2=Vo^2+2*a*(s)
Where Vf=Final velocity Vo=initial velocity, a=acceleration, and s=displacement

Vf=a*t+Vo
Pretty straightforward here. Final Velocity=acceleration*time+initial velocity.

You could use some kinetic energy ones too:
Ke=1/2*m*v^2

This is useful for collisions and figuring out how fast each object moves afterwards. Remember ENERGY IS ALWAYS CONSERVED! So if a moving train hits a stationary one, the total kinetic energy of the system before AND after the collision will be 1/2*m1*v1^2 . However, if both are moving, you have to add each kinetic energy together to find the total kinetic energy of the system.

If you want any others, I have a few more formulas lying around I can donate.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 25th Oct 2009 04:09
*claps*
Congrats, you now sound like my physics teacher.


Lol, whoa. you sure know quite a bit.....

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Oct 2009 06:54
I am a mechanical engineering student. I have taken my share of physics classes. They were the most interesting classes offered at my high school. Its too bad you can't do calculus in dbc, then I could REALLY pull out some stops.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Oct 2009 10:46
You might find the various equations on my site useful.

http://dbchallenge.com/?page=eq

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 25th Oct 2009 14:05
thanks guys

TGC Forum - converting error messages into sarcasm since 2002.
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 25th Oct 2009 14:06
@Phaelax: Well played. Really like the look of the site, and that Projection of 3D into 2D thing looks like it could be fun to play around with. I'll have a look at it properly later. Unfortunately, got calculus coursework in for tomorrow - you don't feel like doing that for me too, in all your mathsy brilliance?

"A West Texas girl, just like me"
-Bush

Login to post a reply

Server time is: 2024-05-03 21:02:29
Your offset time is: 2024-05-03 21:02:29