First of all, what do you have in place at the moment? Do you have velocities and perhaps accelerations for your objects? A method that allows you to apply forces? Perhaps some “force state” that records all of the forces currently acting on your objects, and their durations?
Are you using fixed-step simulation, or delta-t?
As to specific situations, the simplest should be the application of gravity.
v = v + at (velocity = initial_velocity + acceleration x delta_time)
For gravity, acceleration should be your -9.8 in the z. From this you should be able to calculate your velocity, and from that the distance and direction in which to move your object for a given update.
Applying a force instantaneously shouldn’t be too difficult, I don’t think - f(orce) = m(ass) x a(cceleration), therefore a = f/m. So, for an object of mass m, if we apply an instantaneous force f its velocity should increase by f/m, I think.
(It’s been a while since I took Physics, however, so I may be off on that with regards to instantaneous force application. ^^; )
For forces over time, I think that you would probably just use f = ma along with the equations of motion:
v = v0 + at
pos = pos0 + v0 + 0.5atÂ²
pos = pos0 + ((v0 + v)/2)t
vÂ² = v0Â² + 2a(pos - pos0)
Where v is velocity, pos is position, a is acceleration, t is time (probably time since last step, in your case), and the values with zero appended are initial values (at the start of your step, presumably).
Simply replace the x values above with vector versions (in other words, pos instead of x).
These of course assume constant acceleration, but for sufficiently small time-steps they should work, I think.
You might be well served by a search or two of this forum.
Finally, your fourth problem can, I believe, be solved by firing a ray down from your character and detecting the first collision with whatever you consider to be “terrain”.
(Take a look at the collision detection section of the manual, if you haven’t already. I would suggest a ray collision solid, parented to the object being tested, with a bitmask being set as the ray’s “from” bitmask, and the same value being set in the relevant terrain objects as the “to” bitmask. Use a CollisionHandlerQueue, and call the sortEntries function to get the entries in order from nearest to furthest collision - the one that you want should be the first.
(I think that this was described in the manual somewhere, although I may be wrong.))
Of course, if you have a simple horizontal plane as your terrain, then you can simply fetch its z-value and use that.