Don't allow to uncrouch under a structure

Hey,

I followed everything you told me, hoping I followed it right, however, something went wrong, a new bug showed up: when I press crouch input, the character no longer comes back up, but remains permanently crouched.

I will send you all the screens of the nodes



I just noticed that the sprint input also suddenly froze, what have I done :c

Hi there,
Don’t worry about it. You did a great job.

Now that you have all done, it’s easier to do the debugging. For instance, have you set the initial value of “can uncrouch?” to true on begin play? Also, there are booleans disconnected from branch nodes. Did you missed simething or maybe you don’t need them anymore? Such as “already crouching” and “can sprint”? Do you really need those booleans?

Try to review your code reading through every step and ask yourself what do you expect to happen in every block of code.

For instance, input action crouch “released” you’re calling event uncrouch twice. You can remove the second call in the end.

You just need to fix the branches in both input action events. The rest of your code is OK.

Hey,

oops, I totally forgot to set the Can Uncrouch? value to true and fixed it right away!
I removed the two variables Already Crouching and Can Sprint? and the character sprinted again!
I removed the second uncrouch call in the crouch input, I hadn’t noticed it at all…

The only thing is that the character remains crouching even when the crouch input is not pressed I am not understanding what conflicts with it

1 Like

You are almost there.

Can you please update all code with screenshots with your latest review?

Of course! Here you go:




1 Like

Thanks. I am guessing you uncrouch is bugged because your capsule trace is hitting your own charater and is registering a false structure above. It shouldn’t be the case, because “ignore self” is set to true.

To debug, on capsule trace, change “draw debug type” to every frame or persistent and see the color code in playtest. Green is the default color for hits. So, you want to see trace hits only if crouching underneath a structrure.

Hey,

I activated Draw Debug Type and it seems that most of the color is red (Corresponding to Trace Color) although green color is present (In small part [Trace Hit Color])
I’ll show you:

1 Like

I figured, your final assignment is to find the correct settings. A quick one is to replace “capsule trace by channel” by “capsule trace per objects” and use “World Static” as the only option (dark green array icon, select and right click and find “make array”, a list of options will appear). Everything else is the same.

Something’s odd. Why are those green lines going to the blue cube?

I’ve noticed that too, I haven’t gotten to the point of modifying objects or structures yet, just the player’s movement, the only thing that cube has is to have physics, which is the basic physics of the first person template, also I’ve fixed what you told me, I’ll attach the screen:

I also tried deleting the cube, but nothing changed,

I also found out this strange “Dinosaur” (?) But it was automatically generated in the template, so I don’t know but it was in the position where the green lines started…

Are you still getting the green hits outside the structure?

Not sure but I think so, I’ll try to send you a video

This is a billboard and there must be the level origin. So if your green trace is going to that location, I can’t possibly see why.

This is the situation now:

Perhaps the appearance of the green lines is correct, however, on closer inspection…

Can you please show how your character is setup? Can you record a video showing the components mesh capsule camera etc.

Also, can you select your capsule and go in the details panel, and set hidden in game to false? It seems your capsule is stucked at origin while you move your camera around.

I thought that your trace start vector was incorrect. I watched the video I’ve sent you, and it’s correct. There’s something missing here.

Hi there,

I may have found the problem: after the Capsule Trace For Object, I inserted a Break Hit result, and connected the blue branch (On Hit) to it and connected Initial Overlap as a condition to the branch, I don’t know if I was clear, but in case I attach a screen.
Now the character if he is not under a structure, he will crouch correctly, but when he is under a structure and releases the crouch input, upon exiting the structure he will stay down until the next crocuh input