## Physics with enertia

Nibbie
Posts: 2
Joined: 2009.01
Post: #1
Do you know EV Nova? I need to be able to do physics like that, the ship has inertia, you can be knocked about by impacts and other forces, and you can thrust in any direction to offset your motion. How would you program this, how can you program something that will keep track of inertia and so on? Thanks, William Hogben.

*edited for spelling by David*
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
inertia

Any basic text on physics will give you the standard Newtonian equations of motion.
Member
Posts: 196
Joined: 2002.04
Post: #3
Try http://www.martinb.com that's my favorite site for computer programming physics.

Hope this helps,
Iceman
designdb
Unregistered

Post: #4
I was just playing with some of this...

For an affected unit, I tracked a position and a "heading", heading stored as a vector with magnitude.

Forces which act upon the unit are applied as vectors added or sutracted from the heading vector. So, a thrust in a particular direction is a vector of direction (whatever direction I was pointed in), and a magnitude of (thruster power). Be sure to define a top speed if you need one.

The cool part about doing it this way is the way impacts and explosions function. A missile exploding at my 3:00 generates a force vector from the missile's explosion point to my centerpoint (I didn't mess with forces causing rotation) with a magnitude of the explosive force of the missile. Different missiles all exert force the same way, differeing only in the magnitude.

Does that help?

James Ramsey
Nibbie
Posts: 2
Joined: 2009.01
Post: #5
thats great, thanks, that helps alot!
Member
Posts: 196
Joined: 2002.04
Post: #6
b.t.w. I'm currently working on a somewhat 3-D space game with 2-D physics. A good place to start for the thrust is Quartzeroids (this is what got me started) which is an open source asteroids type game made in Cocoa.

Here's the link: http://www.versiontracker.com/dyn/moreinfo/macosx/10685
If you can't find the source code I can e-mail it to you since it looks like matt's web site isn't working.

Iceman