i really dont understand the inner workings of the game physics as it stands. reading physics.cpp usually gives me a headache. so its difficult to name exactly what needs to be changed. idealy we shouldnt have to reinvent the wheel when it comes to collision detection. now i have a rough understanding of how that works and im assuming all you need is a position and a velocity vector (as well as some model data, but that isnt changed buy script).
take the way my newtonian script works. for some reason i was unable to get the proper effect by changing Physics.Velocity. i had assumed all i needed to do was to take the velocity vector, and add an acceleration vector (scaled by frametime) to it. but no matter how i did it it behaved erratically. either i didnt understand how the velocity vector worked (i had always assumed it was where i was gonna be in one second time from the current state), or the game was doing further modification to it, or now that i understand how games work better, that physics was operating in another space (even though world space makes the most sence and is what i assumed in the first place). anyway i still dont understand why that didnt work.
so i then hacked in my own physics, and told the ship exacly where it should be. and it worked. this killed collision detection, but it worked. the reason colision detection no longer worked was (i think) because freespace would move the velocity vector all over the place based on the game physics and the ship position went where i told it to go, and you no longer draw a line between you and where you were going. my way of implementing those physics was rather cheap and hackish.
there are
of parts of physics to deal with. linear physics and rotational physics to name a couple. and even if the colision detection is handeled internally, what do you do with the data it generates. for the colision you could have a Physics.ColisionForce and Physics.ColisionTorque. theese would be 0'0'0 unless something colided with the object in question, and if a collision occured in the last frame, they would be abstracted down to an acceleration vector and a rotational acceleration. theese could be added to Physics.Velocity and Physics.RotationalVelocity as desired, or modified as needed to do other things.
now with colisions taken care of, i think 2 overrides are in order. a linear override and a rotational override. theese overrides would disable anything in c that tries to change an object's physics vars, mainly your velocities (linear or rotational). your position and collision would be delt with by the engine. so then all the scripter and the lua interpreter has to do is tally up acceleration vectors, scale them by various vars and build a new velocity vector based on the data. this makes both newtonian and non-newtonian physics models easy to create, as well as other cool things like atmospheric flight.
there are a few things i dont like about some of the existing vars. one thing i noticed which is a real pita is the way Physics.VelocityDesired and Physics.RotationalVelocityDesired seem to be pre damped by the time they reach scripting. when i think see those var names i think "what im telling the ship to do" as in where my controls are positioned, rather than "as close as i can get to what i want to do based on what the ship can do". but the purpose of scripting in alternate physics is to decide what the ship can do, and do do that i need clean, unmodified control imput (though it can be scaled and sensitivity increased as per the options in the control panel). but pass the damp and rotdamp vars to use in a manor decidable by the scripter.
pass all relevant physics data from the tables to supply us with tweak factors.
somewhere along the line after the controls update that, iirc, taylor has planned, and when we get things like axial control over lateral and vertical thrusters, id like lateral velocity desired and vertical velocity desired.
make them work in the same way as the main thrust. i never really understood the current implementation of Physics.LateralThrust and Physics.VerticalThrust. the script output.html file gave them a value from 0-1 and i never got why it wasnt a -1 to 1 setup. at some point i want to do an engine accurate flight model that uses engine positions, normals and radii to determine what acceleration vectors should be applied to what parts of the hull. theese give ships with things such as vectored thrust some rather intresting flight characteristics.