Rotating Children of Character Only works on one of the children

Hello All,

I have children of my base character class(Male & Female) When I reference them I cast to the Parent character and save that reference.

This is how I rotate the character mesh. The problem is that it only works on one of the characters, the one that is possessed first in the world. On the other character it still fires the code but doesn’t actually rotate the mesh. I feel like it could be an inheritance problem since I cast to my parent character. Does anyone have any idea on how to fix this?

This is my set reference.

I have the parent character spawned as well as both male and female behind the wall I have as a separator. On begin play of the game mode it randomly chooses what gender to teleport to in front of the wall and possesses it (This is the only one that is able to rotate). If I wanted to switch to the other gender it teleports the current one to behind the wall and un-possesses it, then it teleports the other gender to in front of the wall and possess it. I only want to rotate the one I have in front of the wall.

Thanks,

You only set the variable “My character” once on begin play. So even though it is no longer the “possessed” character, it is still the one in referenced memory. When you switch characters you need to also have code that resets the “My character” variable so that it becomes the one you are rotating in your first image.

Thank you for your reply. I received this information from a forum thread I had opened. Currently I have the reference to be reset by a retriggerable delay. Is there a better option?

I have created an event in the player controller that updates the reference. I call it after my possesion logic in the game mode. Thanks for helping me think about this!

I don’t understand why you would want that logic…It doesn’t make sense. You start the game, wait 0.2 seconds, set the “My Character” variable, then loop back to the delay, wait 0.2 more seconds and set the variable again to the exact same thing. Having a delay there is useless. What you want is something like this:

  1. On begin play, randomly select character (1) and teleport to front of wall, set “My character” variable to character 1, begin rotation of “My Character” actor reference (in this case character 1)
  2. User selects a character switch
  3. Off the switch event, character 1 is teleported behind the wall, character 2 is brought in front of the wall, “My Character” variable is set to “character 2”
  4. Rotate “My Character” which is now character 2

That’s exactly what I was typing out in more detail for you haha glad you got it.

I appreciate your help. It’ll be here for the future for someone else to hopefully find if they ever have the same problem!

Haha, yea you should fix that forum thread now

Done, thank you.

For the future if someone wants to read the thread it is:
https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1481013-rotating-children-of-character-only-works-on-one-of-the-children