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?

Thanks,

How are you setting “My Character”?

I have updated the post to show how I’m setting the reference.

Do you have both characters in the world and both are controlled by the PlayerController? Do you want to rotate them simultaneously?

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.

The problem lies with the poss / unposs of the controller.

make sure that you are possessing and unpossessing in the right way. For example:

And just one question: where are located the BPs you show early in the thread?
If they are in the controller, then the problem is that at the Begin Play you are setting a ref to the first pawn, and it will remain until the end of the game. So, it would be better to connect that logic in the “Possess” event and not in the “Begin Play”. That way, every time you possess a new pawn, the ref. is updated.

Currently this is how I have the possess/unpossess set up in the Game Mode

(This is an Unpossess of the Male)


And this is the possession. It is the same for both Male and Female

These functions are called from my character creator widget

The tele male to spawn function teleports the character behind the wall and unpossess it, the tele female to cc teleports the female in front of the wall and possesses her.

Am I wrong in doing it this way? The only difference in your logic is that it’s called from the player controller/character. I don’t think I really have the luxury of doing it that way because I don’t want that code to persist into the game world.

The first pictures are from the Player Controller.

I have solved the problem by adding a custom event to reset the reference which is called from the game mode. Thank you for your help, you gave me the thought that the reference was static and wouldn’t change.

Here is the picture.
updatereference.JPG
Once again, Thank you so much for your help! (So the ab