# Why is the second branch of this code not activating?

**URL:** <https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823>\
**Category:** Blueprint\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [September 25, 2025, 3:15pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823 "2025-09-25T15:15:47Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 25, 2025, 3:15pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/1 "2025-09-25T15:15:47Z")

</div>

code seen in [Fighting game - How to always make fighters face each other? - Programming & Scripting / Blueprint - Epic Developer Community Forums](https://forums.unrealengine.com/t/fighting-game-how-to-always-make-fighters-face-each-other/270681/2)

 ![lucien_char2 25_09_2025 12_13_20](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/c/4/ac4a615357cb78fff77ad7ec1471e2f410f9131d.png)

---

<div class="post-metadata">

**Author:** ![usa423](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/usa423/32/918773_2.png) [@usa423](https://forums.unrealengine.com/u/usa423)\
**Post date:** [September 25, 2025, 5:31pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/2 "2025-09-25T17:31:06Z")

</div>

Hey dude, two things, what does the print string before the branch say? As in is that getting fire or not? And two, can you provide a better resolution diagram? Thanks.

I seem to have noticed there have been a few inquiries to the fighting game threads I have made through the years. Perhaps I picked the wrong template to spend the most of my time on? The ambitious idea originally was to make a series of templates within Unreal Engine, for example a fighting game (Mortal Kombat, Street Fighter, Killer Instinct, etc etc) a ship scroller (U.N. Squadron, Gradius / LifeForce, R-Type, etc etc). and a beat em up (Double Dragon, TMNT, Golden Axe, Final Fight, P.O.W, etc etc). The beat em up I have spent the most time in and got the furthest, conversely I am thinking now it may also be the most difficult. As it is essentially a 2.5 D game, sure they are all 2D games at the end of the day. Probably the next most diffcult would be the fighting game. Although in a local multiplayer way perhaps easier if it did not have a single player and you didn’t have to worry about enemy movement behavior (EMB). Case in point would be Mortal Kombat 2. Lets say you are facing off against Liu Kang controlled by the CPU. As soon as the computer allows you to move what will he do? Block? Bicycle kick (time charge move)? An upper fireball? A lower fireball? A flat foot jump kick (a good defense in fighting games imho)? A forward jump kick? Will he advance on the player? Will he do nothing? Add that up, that is eight possibilities. Get a random int in range, set the range from 0 to 7 (because in programming it seems you start counting from zero in many cases), drag out from that and choose a switch on int, add the zero to seven pins, there is an eight way random possibilty every time it receives a single pulse.

---

<div class="post-metadata">

**Author:** ![Aut0ton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Aut0ton](https://forums.unrealengine.com/u/Aut0ton)\
**Post date:** [September 25, 2025, 6:18pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/3 "2025-09-25T18:18:21Z")

</div>

It seems like you set the if branches in a way where if the first IsOverlappingComponent is false, then the If Branch for when its true never fires the next If Branch. I would just simplify it into one If Branch if you are just using P2 A Box for both of them (the resolution makes it hard to see). If its P2 A Box and P2 B Box, I would just connect the if branch when P2 A Box is True to the other if Branch as well.

---

<div class="post-metadata">

**Author:** ![usa423](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/usa423/32/918773_2.png) [@usa423](https://forums.unrealengine.com/u/usa423)\
**Post date:** [September 25, 2025, 6:33pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/4 "2025-09-25T18:33:31Z")

</div>

That seems to be the thing in Unreal, there are many ways to do to accomplish the same thing. Think when I first tried to achieve it I was using some wonky method with box collisions. I also can’t make out enough of the diagram to offer an opinion.

Its been a minute since I made that thread but lets see here. First get references to both characters. In this case like old side scrollers and beat em ups they are either going to be facing right or left at all times. So you only want movement on the Y and the Z axis (when you jump). You need a fast firing and constance source like the Event Tick. Get your refs, get your mesh, find world location, IF the other player’s Y exceeds or goes below your Y then you need to set actor rotation, on the Z. Throw some numbers out and see what happens -90…..90……180……-180. And adjust accordingly. And like you said, it should be able to be done with one branch. But since it is a fighting game you will have to make the other character also flip in the same way. So that the character’s are always face to face.

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 25, 2025, 7:27pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/5 "2025-09-25T19:27:55Z")

</div>

the print string just spells Hello. Here’s a new screenshot because my monitor is dogwater

 ![lucien_char2 25_09_2025 16_26_15](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/6/f/a6f7cc5a9e32d2d4c314759a2aae34cfc27477c3.png)

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 25, 2025, 7:29pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/6 "2025-09-25T19:29:48Z")

</div>

is there something wrong with my character blueprint itself? it seems like everytime it turns around a huge phantom collision appears on the back of it even though i set the arm hitbox to not collide

 ![lucien_char2 25_09_2025 16_28_11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/0/180574b919bfcd0044b939f39cb19b44ad96bc23.jpeg)

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 25, 2025, 7:33pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/7 "2025-09-25T19:33:57Z")

</div>

please show me an example blueprint? i’m new at this and english is not my first lauguage

---

<div class="post-metadata">

**Author:** ![illspiritx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@illspiritx](https://forums.unrealengine.com/u/illspiritx)\
**Post date:** [September 25, 2025, 8:03pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/8 "2025-09-25T20:03:02Z")

</div>

Hard to read screenshot, but it looks like it’s checking the same overlap twice, so both would fail if the first does.

Instead of checking overlap for multiple boxen. you could just find the look at rotation , and use a dot product check against the foward vector to see if they’re close.

 ![LookAtTarget](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/9/f99c1960e0f8e025a0557265b3fcd967b06a9af3.jpeg)

A return of 1 from dot product node means vectors are the same, so .8 is within like 18 degrees.

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 25, 2025, 8:14pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/9 "2025-09-25T20:14:28Z")

</div>

your solution worked, but since i’m using flipbooks, the rotation causes tearing. how can i adapt this to flipbook logic?

---

<div class="post-metadata">

**Author:** ![illspiritx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@illspiritx](https://forums.unrealengine.com/u/illspiritx)\
**Post date:** [September 25, 2025, 8:40pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/10 "2025-09-25T20:40:16Z")

</div>

Maybe have a second branch before setting rot and if look at is \> 0, set rot yaw to 90, else set to -90. The final rot would depend on which axis your camers is aligned to. Could be some slight non perpendicular rotation angle is causing the flipbook to break? Or maybe use relative rotation on flipbook comp. I’ve not used flipbook feature very much.

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 25, 2025, 9:33pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/11 "2025-09-25T21:33:22Z")

</div>

i think it’s because i’m using event tick to call the function and event tick updates too many times and causes the tearing, don’t know how to solve it. tried to use event begin play + call timer by function but it only called the function one time and i want the function to be called everytime one character exceeds the y of another, but at this point the code is just becoming redundant

 ![lucien_char2 25_09_2025 18_30_29](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/d/49d47a1da03f1199b7b0dce502adfffe67b0f5bc.png)

---

<div class="post-metadata">

**Author:** ![illspiritx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@illspiritx](https://forums.unrealengine.com/u/illspiritx)\
**Post date:** [September 26, 2025, 2:47am UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/12 "2025-09-26T02:47:14Z")

</div>

Instead of using set actor rotation, try using Set Control Rotation to point left and right. Then in character movement component, tick the option to Use Controller Desired Rotation, and set the z rotation rrate something high like 1000. The AI or player controller will immediately snap left and right that way, and the movement comp can handle rotating the sprite.

 ![PaperTurn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/7/a/07a7664eff96f7a678a29543a4f92d99ae741310.jpeg)

The less than check heading into branch there is from my x move input, but it should be fine in a tick even too, since enhanced input basically happens on tick ( give or take a ms or 2 depending on hardware polling lol).

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 26, 2025, 11:55am UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/13 "2025-09-26T11:55:10Z")

</div>

actually the solution didn’t work. just caused my character to arbitrarily flip while giving the illusion of looking at opponent because of sprite tearing

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 26, 2025, 12:19pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/14 "2025-09-26T12:19:19Z")

</div>

okay, found a solution for the arbitrary flipping but now the second branch won’t activate

 ![lucien_char2 26_09_2025 09_18_56](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/b/b4b941db2bf97b9cca847eeb8bf84354d13fd488.png)

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 26, 2025, 12:57pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/15 "2025-09-26T12:57:45Z")

</div>

![lucien_char2 26_09_2025 09_56_19](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/8/908cacf6f61a1e317d5e6e092eb52daad5572d0a.png) i’m almost solving it, but how do i make the character keep the rotation when it rotates 180 degrees?

---

<div class="post-metadata">

**Author:** ![Guigoso2006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guigoso2006](https://forums.unrealengine.com/u/Guigoso2006)\
**Post date:** [September 26, 2025, 1:01pm UTC](https://forums.unrealengine.com/t/why-is-the-second-branch-of-this-code-not-activating/2659823/16 "2025-09-26T13:01:15Z")

</div>

![lucien_char2 26_09_2025 10_00_49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/f/1ef8d65b86fac7937adb4d24b7786b5f53bfd0e2.png) solved it, thank you guys for help
