Basically I have two players, Cube1 and Cube2, with their own character controllers and cameras. I can switch between them by pressing keys 1 and 2. While moving Cube1, Cube 2 is immobile and vice versa. My problem is that if I'm moving a character and switch to the other character while I'm still holding down either the WASD keys or arrow keys I use to move, it will keep on moving as if a move button is still being held down (not because of physics. having the other player continue to be effected by physics when I switch is what I want to happen).
Here is the code I'm using. Both cubes have the default Unity FPS scripts: Character Controller, Character Motor, and FPSInput Controller..
As long as switching doesn't stop a character from being affected by physics it's find. I just need to stop the inactive character from wandering off. Also any suggestions as to how I can handle this script better if I want to add a lot more characters is most welcome :) . Scripting is not my strong point.
asked Apr 26 '12 at 08:07 AM