How can I respawn camera when a new character (that uses same blueprint as previous one) is possessed?

I am implementing a top down camera (with sway) that follows player around in first person template. I have 4 characters that can be possessed at any time by activating their relevant trigger. Currently my camera is set to spawn on Event Begin Play so it works as it should for first character. However when a new character is possessed camera does not point in right direction. I assume that this is because it is only spawned when play begins. Is there a way that I can spawn camera whenever a new character is possessed? Here is my current Blueprint setup.

Thanks.

Hey ,

There are Event Possessed and Event Unpossessed nodes that might help you. I think problem might be that you’re setting View Target on Event Begin Play, which fires when Blueprint first enters play. In this case, I assume your other characters are already in level, so that would have fired already. Setting this on Possession might solve your problem.

Hope that helps. Let me know if you have other questions!

Hi !

This still isn’t working unfortunately, When I use Event Possessed right camera spawns but it is not facing in right direction and player still has left and right control of it with mouse (which should be disabled). When I try to spawn it at Begin Play it defaults to wrong characters camera. Would I maybe be better off duplicating blueprints and using a different one for each character? I’ll do it if it works but it might meant changing a lot of references around!

Thanks for your answer.

You shouldn’t have to create separate blueprints for each character if they are supposed to be functionally same. We just need to figure out this issue!

So I’m going to try to duplicate issue you’re experiencing, and I have some questions:

  1. These characters already exist in world before you possess them, correct?
  2. What method do you use to possess them? When you possess them, are you using same Player Controller? You mention an event; is this a key press event, or something more complex?
  3. It looks like your character has a camera component that you reference for world position, but then you spawn another camera. Is there a reason you’re not using camera component itself?
  4. Is this project built from first person template or third person template?

Thanks!

Hi ,

Thanks for getting back to me again.

Yes characters are placed in world beforehand.

Each character has a separate Trigger Volume attached to it at Begin Play. relevant character is possessed when an actor that has a certain tag overlaps their Trigger Volume (this actor is a projectile).

I am not using camera component itself because camera setup is based upon this tutorial, which I believe does same (although they are using third person template and I am using first) - https://www…com/watch?v=QPms7QwNdcg

Thanks.

edit: here is player possession:

Thanks !

I was able to set up what you’ve got and it seems to be working fine. problem, then, probably isn’t with camera setup you have. My possession setup is a bit different, since I don’t know what your Player 1/2 possessed or Close3 functions do. Let me explain how I set this up and we’ll see what you have that’s different and go from there.

Starting with First Person template, I took MyCharacter Blueprint and set up Camera Sway same as shown in that tutorial. Testing this, it works as intended (though it looks a bit weird because I’m using default mesh for arms).

I created a Sphere component in Character Blueprint that surrounds player and called it PossessSphere. I then customized its collision so that it ignored everything that is not a projectile, and it overlaps projectiles. There are certainly more precise ways to set this up, but this is simplest way to go about it.

Then I set up a basic possession process like this:

So when I shoot an instance of MyCharacter in level, it automatically gets possess and camera is in right spot. This seems like a better way to set this up because it can be used in more circumstances without having to rely on Level Blueprint at all.

Let’s compare that setup, which works way you want it to, to what you have now. It looks like you’re doing possession in Level Blueprint, and that you have a custom Character made. I would start with Character Blueprint and compare it to default MyCharacter and see what’s different.

If all that looks correct, then I would guess it has something to do with your possession method. I can’t really see all of how you have it set up right now, but I would recommend staying away from using Level Blueprint for this if possible.

Hope that helps some! Let me know if you still have questions.