FPS Crouching

AHAHAHA, I love this guy!
I m laughing till now, dont get mad man, It s just talk.
All your skills are too mutch to me to understand, why should I mock you, no way.
Congratulations about you excelent way to make it!
I really want to see this working on a FPS for good!
You ar the best magicjohson!

Monter s method is the best if when we replace the mesh and parents still working, i ll try out, thanks monster this is the only real physich related way to make it until now!

Good, that you take it with humor, whereas I admit I’m not so the funny kind of person. But now that we cleared that up, back to topic. I completely agree that Monsters approach is interesting indeed, because only this way the physics will remain realistic over all.

However the TriangleMesh will force new drawbacks later on if you need to walk over variable terrain (stairs, slopes). With using TriangleMesh collision type as player-object enabled you will get stuck, no matter which base object you take. The default collision bounds of a simple box however will enable to walk quite smoothly over stairs and terrains (if somebody didn’t try it out yet, please do so, and there was also somewhere an old demo from jplur showing that). Replacing an object physics mesh of an object which has default collision bounds however will not work - that’s really something that could drive you up the wall, and only because the physics in BGE seem to be incomplete!

Maybe a combination will work, but somehow I doubt it because then the real compound-issues will appear again. I’ll give it a try though…

Hmmm, after lots of experimentation and asking in the gamechannel it could be possible to arrange it with TriangleMeshes completely - without messing up the smooth movement over terrain/slopes/stairs (which you have only with a bounding sphere) too much. One can use a cylinder to approach this behavior (8 segments figured to be best working on my trials, less or more resulted in getting stuck, don’t ask me why the 8 did not…), and with the center vertex on the bottom create a cone. This cone will try to make movement smoother, but still it’s not as nice as a Spherebounding.
However once this is done, nothing stands in the way to replace the mesh with a smaller one, as suggested by Monster. Crouching would work this way and the physical mesh would be correct anytime.

Some hints:

  • Advanced->Margin to 0.5 (both on small and bigger shape)
  • Material friction of cylinder about 0.2 and the other materials to about 4 (stairs maybe lower). Higher friction values on the cylinder will cause it getting stuck more likely.
  • if Terrain is not smooth enough (“set smooth” is not sufficient), use sculpt or modifier to smooth out more, otherwise getting stuck is a major problem
  • you can see that the movement on the stair is not so smooth as when you replace TriangleMesh Bounds with Spherebounds. So if anyone got a solution on how to achive the same smooth movement with TriangleMesh, please let me know.

ps: you can activate crouching only 1 time in this file, sorry)

Attachments

crouching.blend (242 KB)

Can you use shape keys in the game engine? I haven’t used them before but believe you can change the shape of your bounding box with those if thats how they work?
Sorry if i’m wrong i haven’t uses blender in a while but do hope make another game soon.

Interesting question, I tried it out, but the physics shape will not update, no matter which bounds you take. OTO has posted a file some time ago here for demonstration - however when you start the game engine (physics visualisation enabled) you’ll see that the physics size remains the same :frowning:
As for now, Monster’s solution with replacing the mesh seems to be the best.

edit:the cone shape of the playerobject in my previous post does not work good enough. The Trianglemesh is a real pain regarding walking over uneven ground… no matter how you smooth it out. Sooner or later it will get stuck

edit2: sorry to edit again… A probable solution to the cone problem getting stuck ist to create a small flat bottom for the cone, instead of the peak. Also the movement seems a little bit smoother this way.

Btw. as it seems - trying to fake the crouching with any other solution (including my own proposal) than Monsters proposal will lead to even more fucked up results; even when scripting it causes such a large amount of hassles… - you’ll never be happy about. Can’t recommend that.

Sorry I havent been here for a few days. I’ve been a little busy.
Monster’s solution seems to be working good for me.

One question…

Why couldn’t he use it? If I’m going to use this setup in my game, I would like it to work for everyone.

And thanks alot guys. I can tell you have put a lot of thought and work into helping me out with this question :slight_smile:

Here it is. I made a working FPS setup with functional crouching. I used Monster’s method and it works flawlessly for me. Can you guys tell me how it works for you? :slight_smile:

Attachments

fps_crouch.blend (43.7 KB)

*Poof!

@Jay_Dee_982:

  • It works for me :).
  • Gomer didn’t said why he couldn’t use it. He just said he couldn’t use it with his setup. I think he required a non-triangle compound at this time.

@KingofTheCrows: This would not solve the described problem.