FPS Crouching

I’ve been trying to think of different ways that you could set up a FPS so that the character can crouch. All of my ideas have had flaws. Basically, I want to make the player be able to crouch and the player’s bounding box needs to get shorter as well.

I figured I might as well ask here, because I know somebody must have a good idea for how to do this. All help is appreciated :slight_smile:

Scale IPO?

As in an IPO animation on the bounding box that shrinks with the character.


Double Post. Sorry.

A scale IPO would shrink all of the parent objects.

Perhaps having 2 bounding boxes instead of 1. Top one is parented to the bottom one. When the character crouched, the top box moves or rotates into a lower position

Yeah good idea! You could have one main one, then replace the mesh with a smaller one when the unit is crouching.


Parenting wouldn’t work, because the child object won’t have collision.

That might work. I probably could replace the bounding box mesh with a shorter one. Then I could just have an IPO for the camera to move down. That might just work! :slight_smile:

Parenting wouldn’t work, because the child object won’t have collision.
It would if you enable ‘Compound’ on the father object and ‘Add to parent’ to the child object (which has dynamic enabled).

In 2.5 in both cases it be called Compound, I believe.

I might try that then. Thanks :slight_smile:

Interesting, since I’m also working on that I did consider scaling down or the solution mentioned with the smaller box on top which will be moved down as well. I’ll give it a try too.

I would pickup Sunjays first suggeston: Scale-IPO. The childs could get a scale IPO that scales opposite to end up with no scaling.

just a suggestion

Good idea! I never thought of that. I think I will try that right now…

I tried sago’s suggestion with “Compound” (main lower box) and “addParent” (upper box) and it works flawlessly. I still wonder if the scaling-IPO would be more “secure” in matters of physics/collision issues… because it wouldn’t need to be added into the “compound” I guess… any ideas which is better?

edit: hmm I’m not sure for the above solution, with the upper box moving downwards: the IPO doesn’t seem to update the collision… and therefore still cannot crouch
Also, supendDynamics() does not work, downscaling does not work… hmmm and reinstancePhysicsMesh() will also not work because the API says it does not work on compounds…

Has anyone actually solved this seemingly easy - yet difficult problem? :frowning:

edit2: ok, as long as one does not use a compound object (of 2 dynamic boxes), and instead uses a single one… the crouching works via “downscaling” - IPO. But let’s say you put in this “box” a playermodel: wouldn’t it be downscaled as well when parented to the “box”?

Another way would be to replace the collision box mesh with another mesh. Make sure to replace the Phys mesh. The Gfx mesh should be invisible anyway.

Interesting… the replace mesh actuator replaces the physics mesh, but rigid bodyies still does not recognise is… more confusing this does not work for dynamic objects… This is not good.

It works with addObject and endObject. But that makes it much more complicated. Especially you have to reparent the children and add all logic bricks on both objects (<ctrl><c> would help with that).
I can’t recomment that.

I was looking into this a few months ago. I tried every method suggested here except the compound objects. I found replace mesh worked, as long as your character is a single object, but it requires you to use triangle mesh which didn’t work with my setup. I then tried IPO’s but I found being forced to use logic bricks restricting. I finally settled on using python and object.localScale for basic crouching. Scaling the children up while the parent scaled down. It appeared to work, although it seemed like a fair amount of code for something that sounds so simple…

:eek: Argl*… I agree this sounds not recommendable, it will certainly cause later on more problems…

:eek: Waargh*…! This is also more than an ugly solution. Especially if you need to add more than the simple “gunhand” to the character

Unbelievable that this “easy” things is practically undoable here… I mean crouching even worked on old games from 1995 (e.g. Blood)…

Very strange, I think I got something.
I used 2.5, so it might be because of a bug that it works…

There are 2 bounding boxes. Bottom one being the parent. It only works with:

  • parent box set to Triangle mesh and Compound
  • child box set to Triangle mesh, but NOT Compound
  • child box is EXACTLY on top of parent box (only moved on z-axis)
  • child box only moves down with the F-Curve played (z-axis)

Another thing that works instead of the F-Curve Actuator is the End Object for the child box. Then you only need to bring it back after the crouching…

After pressing P press Space to duck


duck_physics_weird.blend (73.6 KB)

Hmm I see an error in that, I experienced as well: if you place a static box in the height of the upper box to simulate a “tunnel” which forces you to “crouch” under - although the playermodel is standing it will pass through. It seems there is no collision anymore on the upper box, although I can see it is “Dynamic”…:frowning:

I resign and probably do the scaling trick (see attachment), which was mentioned by gomer:
somehow the scaling down process is slower during scaling action, than the upscaling and therefore make an “egg-shape” meanwhile… any solutions to that?
(hold C to downscale during playmode)


spielerkollision.blend (206 KB)