Hi there,
In my project, I have a default pawn class that consists of a static mesh, spring arm, and cinecamera components. Additionally, I have an AI character controlled by my custom AI controller. What I want to achieve is to start possessing my default pawn initially, and when I click a button that I have already created using UMG, the cinecamera in my default pawn smoothly follows the movement of my AI character (which performs a simple patrol defined in the AI controller).
I have found a way to accomplish this by attaching my default pawn to the AI character. However, I’m not entirely certain if this is a simple and correct approach(And even I don’t know how to achieve attaching). Can anyone provide a clear solution to this problem?
Many ways to do this. We’ve done several projects that work extensively with switching views, cameras, and characters. What we did is:
every character class has a built in camera
any “fixed camera” or “follow camera” the player can use is a character class (e.g. “FixedCameraCharacter” or “FollowCameraCharacter”)
therefore switching from a normal walking character to a follow camera is a matter of Possess()-ing a follow camera character
then UnPossess() a follow camera to switch back to your normal walking character
Having the different cameras be different character classes works nicely because the inputs and other logic are in totally separate files. There’s no mucking up your primary walking character class code with a bunch of special cases.
Additionally we even have a “TransitionCharacter” class where say, if you wanted to do an animated transition from the player view into a CCTV screen (or whatever), which gets gets Possessed(), does the animated transition, then Possesses() whatever the target is. The TransitionCharacter logic is nothing but animating the view from one character to another.