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?
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.
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:
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)
User selects a character switch
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”