Crouch not working after performing Spawn Actor

Hi, everyone,

I can not understand why Crouch stops working every time I perform Spawn Actor. On the other hand, after I perform Spawn Actor I do manage to control the walking speed, which I also lose for some reason after performing Spawn Actor.

Is there anyone here who also had the same problem?

Here is my BP:

What does your crouch logic look like? Are you using any branches and variables when doing so?

My crouch logic is attached to the first person blueprint and it’s very simple:

1

Also, in the project settings, I set key bind of LCTRL to the crouching.

Try to add some Delay between the Destroy Actor and the SpawnActorFromClass. Because deleting an actor isn’t instant, you need to provide some time for Garbage Collection.
Right Now there seems to be an overlap between the two.

I hope that helps. Thanks.

Do you mean like this?

Yes. Does this resolve your issue?

Nope, it just delay the action.
And everything stay the same.

Can you add Print Strings after Crouch and Uncrouch to see if they are receiving Input?

Print string to the crouching action or after the spawn actor with the delay?

I’m starting to realise, that this is some how related to the controller…

Because I have another mouse-related function (zoom function), and it keeps working as usual…

When is your Destroy / Spawn Actor event fired? If you press something while crouching, like switching to the FirstPerson view?
Looks like you are crouching with your character, then you destroy the character itself, spawn a new FirstPerson character and then posses the newly created pawn - and my guess would be, that your FirstPerson BP has no clue you were crouching before? Can you crouch again, after you switched the character?

The Destroy / Spawn Actor event fired after I click on some button from widget.

And your guess is pretty much the same my guess, because after I’m firing the event, everything worked fine except what related to the keyboard movement, such as crouching and walk speed.

Now, I’m searching for a solution to bring back the FPS controller I used to work back again.

Don’t know if it is the best solution, but you could store your Speed values and maybe an additional bIsCrouching in your PlayerController. These values won’t be destroyed. After spawning your new Pawn you could update the Speed values with the already stored ones and also check if your character was previously crouching and then act on that information.

Thanks for the direction, this is exactly what I’m trying to accomplish in the project and still do not understand how. Do you know a guide on the subject?

Don’t know any specific guide, sorry. It really comes down to what your setup looks like. Switching between pawns could be handled inside your own PlayerController. (if you already have one?) The speed values, if not changed regularly during gameplay, can also be set directly inside the respective pawn blueprints? (inside your FirstPersonBP and the other one). That way you don’t need to change them everytime you switch pawns.

Regarding the crouching problem: This may help you there. Never had the need to create such a setup, so … just searching for other people that had the same problem. :nerd_face:

Thank you, I will update the post with the answer as soon as I have. So that others can go through it in peace :slight_smile:

1 Like

It’s starting to sound like you may be consuming the input from another key binding perhaps even from another blueprint and it’s prohibiting the crouch key press to work. It’s simple enough it shouldn’t be hitching like that…

What keys are you pressing to produce this issue? Does any of it have to do with your widgets and bindings to those inputs? Do you perhaps have any inputs in the level blueprint or other blueprints that would be using the same binding, but for different actions?

Okay, I have good news, I found it effective solution for the problem.
Instead of trying to return and change components to the player’s moves with BP, what I did was set it all as default on the player. Something I have done so far in the game scene for the player and not for the player himself.

The result is cleaner event:

Player settings:
2
3

1 Like