Independent camera blueprint setup
Here seeking guidance to a problem I've been having for a while and can't seam to wrap my head around. See in my project we have a third person character that can switch bodies on the spot. Each character blueprint has their own camera setup in them. When the character switches bodies the current camera jerks and jumps to the one on the next body creating an awful visual experience.
Is there a way to create a independent third person camera to look at the character, follow and rotate view? That way when the switch happens the camera stays the same. Or is there a way to make the camera on the main body stay in control?
Any help is appreciated!
asked Oct 24 '18 at 04:36 PM in Blueprint Scripting
Hello, i think the best approach will be in steps :
Hope this help !
answered Oct 24 '18 at 10:12 PM
There are many of ways of doing this, but the simplest most straight forward one I can think of is doing it directly in the player controller BP. I'm not sure how familiar you are with BP, but just to be clear it's not the character/pawn BP, but the player controller itself.
In theory it should actually be cleaner than this, but it turned out to be huge headache because I think there is a bug that changes the player camera view target every time you possess a pawn, even if you disable automatic camera management. Anyway, I found a workaround, the BP below should work.
The key things to take note of are how I am creating a dummy spectator pawn with no collision to store the transform of the character being swapped out. Later I'm actually switching the camera back to this dummy even though I've already possessed the new pawn. This is because of that bug I mentioned earlier.
The other key thing to note is the final "Set View Target with Blend" node. I'm setting the blend time to interpolate between cameras (you can change this to your liking), and checking the box that says "Lock outgoing".
Don't forget to set your default player controller BP if you create a new one. You can try this BP for yourself in the third person template if you like. You'll need to make a custom player controller BP, a 2nd character BP with a different material and/or offset camera component, and some sort input action event.
You should use separate PlayerCameraManager with it's own "UpdateCamera" function.
answered Oct 26 '18 at 12:30 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here