Hey guys. i’ve been working on this FPS project for awhile now. I’ve spent a large chunk of my time trying to get the movement to work correctly. It seems like there are a bunch of different ways you can achieve a typical FPS movement scheme in the BGE but every one of them seems to have relatively serious problems. I’m gonna try to list all the ones I’ve already tried here.
Simple motion - the “easiest” way. Just set up four simple motion actuators that correspond to your movement keys and you get seemingly normal FPS movement. Until you try to move your character up a ramp or any kind of surface that isn’t completely flat. The character will have trouble navigating the ramp and will usually fall through the floor when attemping to do so. The character often manages to walk through walls as well.
Servo motion, no friction - The aforementioned problem is easily solved by changing the motion actuators to “servo motion” and limiting the x axis movement to 0 when moving forward and backward and limiting y axis movement when moving side to side. This creates a new problem - when you let go of a movement key your character keeps moving due to inertia and a lack of friction to stop it. The apparent solution?
Servo motion with friction - add materials to your player and level objects and go to the DYN option under materials (I think its called DYN? if not its something very close those three letters). set the friction up a little bit on both objects. Now when you play your game your character will stop moving almost as soon as you let go of the movement keys. however you’ll also notice that there is no more sliding collision. If you walk into a wall at an angle you simply stop moving instead of moving parallell to the wall at a speed derived from the angle at which you are hitting the wall. Also, dependingo n how high you set the friction numbers, you won’t be able to walk up inclines steeper tahn a particular angle. Usually setting the friction high enough to get the player to stop reasonably quick also makes it so you can only walk up surfaces of the slightest angle.
That brings me to where I’m at now. I’ll call it “modified” servo motion w/o friction. Its basically the same as the first servo motion without friction I mentioned but with the addition of servo actuators that set your velocity along the y axis to zero when you aren’t moving forward or backward, and your x axis velocity to zero when you aren’t moving left or right. This comes pretty close to working like an FPS should. You can walk up inclined surfaces. you can slide along walls. The problems are that:
if you walk into a wall for more than a split second, then, while continuing to hold forward (or whichever direcion you are going) you walk past a corner so you are no longer walking into the wall, you will shoot forward at a ridiculous speed.
whenever you stop moving completely (that is, you were just holding down at least one movement key but are no longer holding any of them down) the character slides the opposite direction of the last movement key pressed ever so slightly. It is a pretty slight problem but for somebody who wants to get their FPS movement RIGHT its still pretty damn annoying.
Has anyone found a movement scheme that works the way it should?