FPS Crouching

Scaling sux too… because of TriangleMesh Bounds limitation, as well as changing the center of object :frowning:

I got a solution which is so ugly that I must share it with you:

Instead of a second dynamic object on the upper part (which wouldn’t work anyways as we have seen unfortunately), we take a sensorbox instead. The mainbody on the bottom is the only real collider we have. It is from the beginning on only half the size of the player.

Now if we try to move into the “tunnel” while standing upright we need to prevent that: we can do that by getting the velocity of the moving object and reverting it. Therefore a bounce-back happens. If we however press the crouch-button at the same time we can move on as usual.

Although this worked on my setup, I am certain that this approach will cause unwanted problems later on… especially regarding: hitareas of projectiles, walking/trying to stand up in caves with variable heights, rigidbody boxes falling upon you and therefore enclosing the camera - because the camera is on a place where no collision is while “standing upright”, accidentally collliding some ceiling and receiving a bounce back onto the floor…

I wished there was a better solution…

Attachments


Wow. I must say that is an ugly way to do it. I thought the IPO solution would work. Someone must have figured out a way to do this. This is just frustrating :frowning:

Did you try out any of our previous suggestions?

Using an IPO - does not work

  • Physics are not updated, you still can’t crouch

Using a compound with 2 dynamic objects - does not work:

  • Physics are not updated or
  • if 1 of the 2 objects gets linearVelocity (walking…) the collision will be removed completely (bug?)
  • SuspendDynamics(), endObject(), Ghost mode etc. also don’t work for compounds

Scaling down the object on its Z axis - Works… buuuuut:

  • At the same time while downscaling the object, all childred get downscaled as well you need to scale up all its children (not so easy than you think…)
  • senseless performance loss
  • center of object on bottom - which can interfere with already existing parts of the object
  • Also you need to enable “Triangle Mesh”: If you have now a playertemplate that works best with default sphere bounding settings (to walk over Terrain, Stairs, slopes) it messes up everything - with the TriangleMesh you can say Goodbye to good movement… also if you persist on using a “Sphere Bounding” you will see that it will not work that nice anymore afterwards and getting stuck happens more often—

=> in short: nothing works

What about the replace mesh option? All you have to do is hit the little “Phys” button to make it update the physics.

Not supported in Compounds.

Also removing a complete playerobject with its logicBricks and its children and replace it with a mesh is not the way to go. Then you need to make double of everything… that’s insane. Besides the “transition” between these two would cause hiccups in my opinion.

this is my example, for me works fine, i dont know how are you trying to make it and I dont download the previrus posts, so if my files dont help you sorry.
Here is the link, its a litle big because of the textures, first press “1” to take the gun then press “c” to crouch.
I dont remember which method I used, I think that I made a visual loc to make it crouch, but I dont remember very well!

Link: http://www.mediafire.com/?ytcgcjmmdoj

Actually it doesn’t work: put a static cube in the air somewhere at 3/4 of the height of the person and then try to crouch under…

Oh, and before I forget, this mouselook has a drifting problem which can be caused anytime after start if you move the mouse upwards first.

no, it works fine for me, but you need to make something first, well i didnt try to pass under something.
Why you dont try this, when Your object is close from the box that he cant pass under it have an near sensor so when you get close enough of that object it loose the pysic behavior but only after you press the crouch button, you create a property to make it don t let you get up when you are under the object and I know that this ll work. At least in my mind
And your welcome, we are trying to help you a little of gratitude will be good.

Then try that first, before talking of “gratitude”… just because your camera downward movement works, does not mean its collision works. This is what the topic is all about.

And for now my own proposed ugly solution is the only one that works…

and all us are trying to help you, so gratitude is given even if our help isnt make that difference, the fact of try to help is more than enough.
We waist our time to try to solve your problem, Learn to use of education.

Please stop your nonsense speech about education or gratitude and get some serious reading skills yourself first. Your ignorance is getting ridiculous, because:

a) You completely ignored what others have read and proposed
b) You are talking of things which have already been proven not working in this topic
c) You are not able to follow my simple explanations to prove it yourself

Otherwise you would see where the problem is, obviously you don’t. You didn’t even recognize that this is not “my” topic where everyone tries to help “me”, but I participated in it and tried to help as well. But enough of that. Once you are beyond the state of “my character can walk on a plane and hold a gun”, I welcome you back in this topic…

  • until then stop your pseudomoralizing talk.

I made a version, but the problem here is that you need to be close to the obstacle to make the guy pass under, but with few other properties will work fine, i think that this is a good way to make it, I have no time now to implement it more, but if you guys can t make it work 100% ill finish soon as I have the time.
I hope this helps, and this is a prof for some friendly people that are questioning about my work, if you dont like magic johson just make it better, and learn to have a little more education, oh, and dont doubt about what I can do since you dont know me.
Once again, i ll implement it soon as i can!

link: http://www.mediafire.com/?g0e0jj2jktm

Actually thank you for contributing a working demonstration. If I may say so, your huge amount of logic bricks and their order of execution during multiple states is pure madness. I really wonder how you can keep track all of them :wink:

It took me quite a while to figure out which bricks are important and what really happens on your setup. Therefore I allowed myself to remove almost everything except the important things and uploaded your file in a smaller version again (3mb,download here) for the less versed blender artists. The result however, is not really satisfying. I didn’t realize the behind-the-curtain-principle until I activated physics-visualisation:

What you do here is - you create a static physical door, nothing else. This gate (box) is simply blocking the way of the player. It will react on the crouchbutton and then move upwards freeing the way while at the same time the camera will be forced into a lower position. The opening is so large that the player can walk through standing upright now. Crouching is only an illusion. The obstacles in the way are only for visual purpose but have no effect, since they have no collision.
In the end this is by far not a nice, nor a universal solution. It will make leveldesign very limited and painful since you constantly need to care about which direction you move this gate, and what happens if this gate collides with dynamic objects. Also think of variable heights, tunnels, caves, multiple stories in buildings etc. this approach will never work out in a satisfying way.

I don’t think that you are happy with this solution either. This is not your fault however, but slowly I’m thinking only a fix of the GameEnginePhysics could solves this inability in a decent way… I will try to implement my own proposal meanwhile and will post a template if it turns out to be “usable” without too many restrictions. Other workarounds are still welcome though.

And it works, hahhahaha, mutch better than yours, what can i say, and please, use a little more your brains kid, the file size was that big because of the textures, not for the logick bricks.
So thanks to reduce the logic, thank god that there is me to make an example for you to copy and make it work too, nice hu!
If at least I had it! Hahaha.
And remember, gratitude is good!
You can try this method on some cases and you ll see that it works fine too!
Magicjohnson if you need help to understand something about the bge interface please, let me know, i ll explain to you without think twice.

I’m curious if we can figure out a way to properly implement features like these into our games.
I’ll try to come up with a solution myself too.

@leonnn:
I am happy to see that you feel some kind of childish triumph, but obviously you didn’t read and think carefully about what I wrote. Your template does not work better than my own proposed solution, instead it is even worse and uglier. If you don’t realize that, I feel sorry for you. Just think more universal…

Btw. I knew why the filesize was so big, but obviously you were unable to remove the textures yourself to present your “solution” in a more decent and more helpful way, also completely ignoring that most people will not even download large files for a single feature (which in this case is still unusable). Seems to be a sickness on your side: being arrogant and ignorant at the same time. Work on that first, then speak again, otherwise you are just messing up this topic.

I tested with gomers method:

dynamic/rigid body with triangle Mesh Bounds + replace Mesh.
This works.
The other boundary types seems not to update the shape.

Jay_Dee_892, you maybe you can use this setup. Gomer couldn’t.

Attachments

compoundTest.blend (158 KB)

I have now implemented my proposal from some posts ago: This solution works, without too much hassles for the leveldesigner or player. I am open for better implementations of course. Btw. it is not exactly the same as in the sketch, because in there the sensorbox didn’t move down. You probably be more safe if only the camera moves down, instead of the sensorbox, therefore the sensorbox can still check if standing up should be allowed or not.

W…forward
S… backward
C… activate crouch

Attachments

crouchdemo.blend (142 KB)