Cancel Crouch When Under Object

I have everything set up for my player’s crouch animation, I have the key set up, the blender, and the blueprints with the flip flop node but could someone send me a picture of a blueprint set up to cancel uncrouching when under an object?

im not sure how one would do it but maybe trying a upward line trace with a short distance may work. or maybe a colision box above the player to detect when it come in contact with something. im interested in a solution to this too.

Basically someone had the same question and someone answered with “I did this once. I just did the following : i set up a function timer that draws a line trace above the player’s head like 3 times every second, if it hits something you set a bool that prevents you from uncrouching, and the opposite if the line doesn’t hit stuff. Wich is basically what you’re doin there. If there’s an error, should be in the trace. First thing set the line trace node to draw debug for duration so you can actually see if the line is goin in the right direction, second you gotta check if the thing above you is actually of the right type, so either a world static or world dynamic object” I would like to see a blueprint set up for this so I could get a clearer picture on this

hmm ill look in to giving you a solution for this. personally i feel like drawing a trace line every 3 second is very uneffective. but constantly drawing it can lower your fps(probably.). i would most probably go with the collision box idea but i guess ill try and give you a bp for this when i get the time for it.

you can also have a look at this and see if you can understand it yourself: WTF Is? Line Trace For Objects in Unreal Engine 4 ( UE4 - YouTube

so which one do you want? i guess ill try giving both of them.

If you could do that as soon as possible I’ll greatly appreciate it man

To be safe and not to mess with the FPS, I think itll be best and simplest way to have a collision box and not consistent line

:stuck_out_tongue: i just closed the editor.
collision box is pretty simple, if you really want that ill give you that next.

but here is the line trace method.

280710-snip1.png

First of all im using a third person character(i have tweaked it a bit.).
i have made a capsule collision box on the player’s head with this setting.

then i have created this function in the bp, you will have to change the + value according to how much farther you want to trace. on the line trace by object you can change the line trace debug type to persistent so that you see the line for debug purposes and when you are fine with how the line is you can set the debug type back to none.

Then hook this up with the event begin play to create a 3 second delay loop:

280712-snip3.png

Collision head is the collision box that i created. im working on the other method rn.

Here is method 2:
Change the box collision size as much as you need and drag it into position.

Also two things about this box: first you can change the box collision settings in the menu to the right to only overlap certain things. you wont need a little part of what i did in here if you do that.

if you do what i said earlier you dont need anything other than the overlap event. just drag the exec and do whatever you want. what i have done in this is just make sure that whatever we are hitting isnt a pawn.

I can’t thank you enough for this!!

You think this method could also work for when in prone position?

Also for method 2, what should be my object that I am going underneath, a pawn? because he still is able to stand underneath the item

in method 2 the object should NOT be pawn.

yh but you maybe will need another collision box for that. and only do something when you are in prone position. so you can maybe have a boolean which checks whether you are prone or not.

What is your red return value and the other white line connected to? That could solve my problem.