   How do deal with multiple control systems
  Hi,I've built myself two demos, one of a vehicle driving around and one of a stick man running (or more accuately, hovering) around the level. I can spawn characters and vehicles as I wish, my instancing system is working nicely. Now, I want to work on control systems.What I am sure of, is that I want to have a method in my base entity class called Control. I've experminted with this like so. The hk and hkp stuff is havok stuff which mostly makes sense:// Vehicle is a public Entity, and implements update like so:void Vehicle::update(VirtualController * controller){hkpVehicleDriverInputAnalogStatus* deviceStatus = (hkpVehicleDriverInputAnalogStatus*)vehicle_instance->m_deviceStatus;float x,y;controller->getAxis("drive",x,y);deviceStatus->m_positionX = x;deviceStatus->m_positionY = y;vehicle_instance->getChassis()->activate();}// Creature is also a public Entity, and implements update like so. This is more complex:void Creature::update(VirtualController * controller){hkpCharacterInput input;hkpCharacterOutput output;hkpSurfaceInfo ground;hkVector4 upvec( 0.f, 1.f, 0.f );hkQuaternion rotatedDir;float x,z; float zr,yr;controller->getAxis("drive",x,z);controller->getRotation(zr,yr);input.m_characterGravity.set(0, -60.f, 0);input.m_forward.set(1.f, 0.f, 0.f);rotatedDir.setAxisAngle(upvec,yr);input.m_forward.setRotatedDir( rotatedDir , input.m_forward );hkStepInfo stepInfo;// ... havok stuff ... //input.m_stepInfo = stepInfo;input.m_atLadder = false;input.m_up = hkVector4(0,1,0,1);// Steer the charactershkReal time = hkReal(5) / 60.0f;input.m_inputLR = x;input.m_inputUD = z;input.m_wantJump = false;// ... more havok stuff ... //characterContext->update(input, output);characterRigidBody->setLinearVelocity( output.m_velocity, 1 );hkVector4 pos = characterRigidBody->getPosition();position.identity();position.yRot( yr );position.setTranslate( pos(0), pos(1), pos(2) );}I could have several axis (e.g. left_4way and right_4way to wrap WASD and the arrow keys, but that makes it difficult to have user customisable control systems.What I'm not sure of is how to develop a control system which allows me to deal with the transition between character and vehicle. Furthermore, I dont know if the AI system should communicate with entities using this control system, or whether the entity itself should know how to dumbly move from one position to another so the AI just needs to tell it where to go.1) How do I write a system which allows me to hand control of an object from one AI agent to another, without undue complexity, and without the AI having to know details which should be specific to each vehicle / creature?2) How do I deal with the fact that human input needs to be translated from language specific constructs such as WASD (different with an azerty keyboard) etc?Thanks for reading, i know this was a little long.[edit] couple of silly mistakes fixed.   
  You need a translation layer between the controller and the logic.  A translation layer will take a control input and produce a command.  The logic then accepts the command and executes it.  For example you have the 'w' key mapped to the accelerator of the vehicle.  Now you would have a translator between the two that maps it to the "accelerate command".  To switch out key mappings or vehicles, just change the translator.Cheers, Bob   ;  For Burt I had another interface called Controllable. And each user had 1 active controllable at a time. There was a player controllable (pc) and a vehicle controllable (vc). When walking around the pc is focused. When you're near a vehicle and press the correct button the pc internally passes focus to the vc. So it goes  user->pc->vc. That's not necessarily the most ideal control scheme but it was effective. You could give user a stack of controllables so pc would just tell the user to push on vc. The problem is vc would have to be capable of popping itself. That's why it's nice to keep the player controller active, and the vehicle controller as a slave. The player is going to maintain a bulk of the logic, the vehicle controller will do very little besides translating inputs into physics.For weapons, Burt was user->pc->weaponcontroller (wc). It worked out pretty well..If you've got two weapons, it's nice to let the pc interpret how each wc gets its input. There will be different mappings for left right, or maybe the same, the wc shouldn't care.   