If there's another forum that would be more suitable, let me know. Otherwise, here goes:
I have a simulated biped with bones and joints like this:
I am trying to come up with a control algorithm for it, so that it can do all of the things the player character in an FPS needs to be able to do. Yes, I know this is more sophisticated than what most (any?) FPS games bother to do, but this is the project I have chosen.
(section added 2016 July 16)
- The state of the Dood (that's what I named the class)
- Scalar control states "yaw" and "pitch" (in radians), "forward" and "sidestep" (fraction of max walk speed in a direction, from -1 to 1) and boolean "jump" (doubles as jetpack control)
- Any other information about the world which might be useful, e.g. nearby terrain geometry
- Torques to apply on each axis of each joint; there are currently 19 joints = 57 degrees of freedom, subtract 4 because the knees can only rotate/torque on 1 of their 3 axes
- Forces to apply at each of the jetpack nozzles; there are currently 10 (3 in each shoulder and 2 in each foot)
- Head orientation; forward vector is higher priority than other axes
- Gun orientation and position; again forward vector is top priority; other axes of orientation, and position relative to the eye point, are lower priority
- Net acceleration as determined by forward and sidestep controls; eventually if 'jump' or jetpack is engaged it should also account for vertical acceleration
- Position and orientation for each foot, and of the pelvis
- Position and orientation of each of all of the bones; alternatively this could be expressed in terms of desired forces and torques on each bone
- Trajectories in joint angle space (I've seen some papers that work in these terms)
The Upper Body Algorithm:
I have an algorithm that works reasonably well for the upper body, allowing him to look and point his gun in various directions, but which relies on being able to dump "extra" torque into something. For example in this video the pos/ori/vel/rot of the pelvis bone is being reset at the beginning of each simulation step:
(warning: the gunfire sound effect is sudden and loud; consider turning your volume down before watching)
However this algorithm is not generalizable to the lower body, because it relies on being able to sink that extra torque into something.
Lower Body Algorithm?
I had a solution that worked for the lower body, under a narrow range of initial conditions, but I have made no progress generalizing it. I tried posting on gamedev.net asking for help, but the subject matter seems to be too advanced for anyone there. Description of the algorithm that sort of worked can be found in that thread: Motor Control Redux.
Also Motor control for physics-based character movement for previous discussion of the problem.
I am at a loss as to how to proceed (but I am too stubborn to give up and do it the "gamey" way).
Any assistance will be greatly appreciated.