Crouching Underneath an Object

I have a third person character which I used the collision box method so he has a collision box around the top of his head with Component Begin Overlap added to it and I already have a blueprint set up for it to make sure non of those objects that the player is underneath is a pawn and the object I have set up is a default collision preset. The player can still go underneath the object but he can still stand up while underneath it and his head sticks right into the object. I know I can use a trigger but I want to make sure nothing can go through the object that the player goes underneath, I ask any one who has pictures for me to help solve this, I added pictures of my own to give you the better idea of what I have at the moment.

uh… i cant understand what you mean. but i think this is a possible duplicate of this: Original Post

No pictures, but it’s an issue I will also need to solve so here is some 2+2 logic anyone should be able to follow.

  1. use crouch and uncrouch functions, obviously. So the capsule component is shrunk.

  2. linetrace above capsule when crouched (bool triggered in 1) and promote hit return value to custom var “am I going to smash my head?”

  3. before uncrouch check if “am I going to smash my head?” Is true or false and prevent Uncrouch if you smash your head.

  4. profit.

This post is used to show everything that I have set up so people know where I’m at and what I am missing

See now I understand everything you said I just don’t understand how I would go about setting this up in my blueprints, for example how do I prevent the uncrouching? Is only one of the questions

Well, I’m afraid you need to watch a ton of tutorials to figure all of it out.

Essentially you just create a branch, attach it to the bool variable and only connect uncrouch to the false pin of the branch.
My preference is a crouch toggle system btw, but you can definitely stop the uncrouch from the release pin the very same way…

You helped me out with the other problem I was hoping maybe you can help me with this one, it doesn’t matter wether I use the collision box method or the line trace method both still need something more done to em than what’s given to me, everyone says the line trace is better and I have the pics of collision and blueprint to how to set that up, I just don’t know why they’re still not working and no one has a clear answer for me.

Or If you can, just share a few blueprint or code snapshots of the current crouching section.

send me a friend request and a msg with everything you need and i will try and send you a reply with all the bp.
including the method you want to use (line trace or box collision)

I will do both of these when I get home from work and get on my laptop in a few hours

whats your username and ill add you on epic games

Basically all I have set up but I am thinking perhaps need to add my crouch animation somewhere and something to prevent standing up and forcing the crouch animation if the trace line is hitting an object? idk tho but what can you do with my set up?

Jeez. Undo that delay loop. It’s an overall horrible idea.
Get us a screenshot of your crouch button press sequence so we can advise on how to deal with that.

Your line trace does nothing, you arent even storing the on hit value into a value to check if you hit something or not. Start with that.
That’s the value you want to plug by your buttons to prevent from getting up.

Have the trace run on tick event, off a sequence behind either a gate or a branch that only casts the ray if you are in a crouched state.

Again. All of that is very basic. A more beefy setup would just detect collision on begin overlap and go back to couched by only using events and not a tick function.

Start simple, once you learn then you can get fancy…

Should I just do the event beginplay to Crouch Colllision check or just delete that entire sequence all together and should I keep my function I created for the second screenshot or move that set up to the third person blueprints area?

Begin play doesn’t need anything in this case.
You wan ontick and branch check if crouched before the linetrace.

I got my ontick connected to a branch, next should I connect my “Is crouching” bool variable to true and check the box then connect it to my Crouch Collision Check Event? My apologizes I’m a slow learner and takes me a min before I understand what you mean exactly

What about this set up?

A method that worked for me was by creating the “Crouch Capsule” just above the normal CapsuleComponent and doing an overlap check, if the Crouch Capsule overlaps anything just use a variable to set the player not being able to crouch

335258-ue4editor-jqhgvffte3.png