Can anyone tell me why my code is broken?

4.27

Simple swimming. Animations won’t activate when entering water. Absolutely not sure why.

Hey @RLK_III!

A couple of questions:

  • How exactly are you determining if the swimming condition is true?
  • Are there more blueprints to determine that value that are not represented here? If so, could you share those?
  • Can you print the value of “Is Swimming” to see if the value becomes true or not?

Any additional information you can provide will be a big help in solving your problem!

Um… let’s see.

I’m using an overlap event in my water volume blueprint - this seems to work as far as the character movement changing when in the water - slow down, drift, float…

No - for some reason IS SWIMMING isn’t activating when in water… I’m pretty new at this so please forgive my ignorance on this - and thanks for the help!

fig 1: Water Body BP
Fig 2: Character BP

Hey @RLK_III!

What it looks like to me from what I can see, is that your character’s movement check is initially set but never updated in the first blueprint you shared.

Instead how you have it currently set up, I suggest making a reference to “Is Swimming” in your ActorBeginOverlap and ActorEndOverlap and setting it there, or doing so in your movement event graph, so your bool can update dynamically.

I hope the above solution works for you.

That makes total sense. I’ll try it out. Thanks heaps!

I did actually forget to add one blueprint… which is odd as this is the one I am most suspicious of LOL I have a feeling the problem is here but I just can’t seem to see it…

Hey @RLK_III,

You actually already shared this one, but let’s take another look at it. Your problem is definitely originating somewhere in the top portion.

So, moving from left to right:

  • Your do once is never reset, so it would never fire for a second time. If this needs to call recursively it will not work.
  • Everywhere else you call your sylvie blueprint to find your character movement.
  • You made a variable just to move it down. If you connect the pin directly to targeting the character movement component, does that change anything?

Maybe you meant to post a different blueprint you were suspicious of, and I would be happy to take a look at that too!

1 Like

Oh, I did too! LOL Dumb on me… I’ll take a closer look at what you’re suggesting.

Here’s where I get confused: I am following a tutorial on YouTube (Unreal Engine 4 Tutorial - Swimming - Part 2 Animation - YouTube) At 6:15 he goes in to the DO ONCE function and pretty sure I am following it step-by-step… so I am not sure what’s going on, exactly. Unless I am just not seeing something staring at me right in the face… which is possible.

Hey @RLK_III!

I can definitely see what you are doing now! I did notice you have an extra node "Cast to BP_Sylvie which takes place before his get character node. Is that firing off correctly? What happens if you place it after the Get Character event node?

If that works, then the casting is failing to BP_Sylvie and you should reference the pawn your character uses more directly.

Thanks mate. I’ll give that a try. CHeers

Hmmm. The first Cast To function exists because I have the option for the player to choose between two characters on the start menu. Event Blueprint Update Animation > Cast To BP_Sylvie > Get Character is working correctly as far as that is concerned.

I wonder… I have a nav movement component for is falling. I wonder if there is one for is swimming? (digs around) Yes, there is one!!

However, when setting speed from a connection I am already using doesn’t work… I don’t think I can branch this… what are your thoughts?

It knows the character is in water and acts accordingly - just won’t kick the animation in LOL

Hey @RLK_III!

That is a dilemma. I see you are getting your speed from multiple locations. According to this, you are trying to calculate your speed for the different scenarios before you are setting those scenarios as true.

Maybe in this case since it is the devault for this scenario, you can make a branch right after “New Function 3” using the value of Is falling from your Nav Movement Component as the true false value. Possibly similar to this:

I hope the above points you in the right direction!

1 Like