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.

Code Snippets / Rough Idea Behind Physics Programming

Author
Message
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 14th Dec 2005 18:54
I dont know if this is how it's done, but I think it is.

I made a bunch of arrays, with alot of types: Object (has data for the object such as traction and mass etc.), Force (linear and rotational for all axis) and energy (kinetic etc).

I know I didn't have an array for everything, but I think it's a good start.

Basically you can change an array so you can do different things to each object, I.e. Say you wanted to turn left, you give it a negative rotational force, rot_force(1).y=-3

rot_force is the name of the array
the number in the brackets is the object number
the last bit(.x , .y or .z) is the axis.

The weight and energy of the object is calculated by the program. I.e. the weight is calculated by adding the world gravity and the mass of the object (both of which you need to set)

I only made one type of energy, kinetic, I didn't bother with potential because you can't go over the ground.

It still doesn't work like it should, I.e. It doesn't change the speed of movement depending on the mass or weight, but as I said it's only the rough idea.

Oh yes, and during the main loop dont forget to call the "Update_Physics()" Function, otherwise it wont work, and you also need to put the Sub where the arrays are all set up.

Here's a small demo.


Darkbasic MADPSP
19
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 14th Dec 2005 18:55
Woot very good thanks zotoaster

Experienced DB http://www.greatgames3d.com (work in progress site)
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Dec 2005 18:31


I think those 50's have to be connected to the speed and mass. The lighter the object is, the lower the lateral forces are in turns. But also when higher speed, the lateral forces increases.

It could be wrong. This is my brain speaking

Immunity and Annihalation makes Immunihalation...
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 15th Dec 2005 19:38
You're probably right..

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Dec 2005 14:03
I don't know. My brain has failed on me many times before.

Immunity and Annihalation makes Immunihalation...

Login to post a reply

Server time is: 2024-11-23 07:40:00
Your offset time is: 2024-11-23 07:40:00