I’m looking for answer about how to set a spawned camera as main camera(the camera in rendering).
Here is what I did:
It seems that if I use “Set View Target with Blend” node, I can set the camera to a PlayerController, which can made the camera as a main camera.
But, my in-use “PlayerController” is not a default PlayerController, I spawned my own PlayerController and want to use it as an active PlayerController.
And there is problem that I got:
How could I set a spawned PlayerController as an active PlayerController? Or is there any other way to set a spawned Camara as main camera?
Easier to create an actor, attach a camera to it, and then spawn it as the default pawn class in game-mode settings
Player controller is also can be set in these settings
I know that I can set the camera to an actor and spawn it as default. Do you know any
other ways? I just don’t want to use the default spawned pawn or player controller and I want to spawn it my self.
Make your own pawn or multiple pawns.
In player controller first “unposses”
then posses pawn you want atm.
Each pawn can have different camera and different logic for it.
What about using a manually spawned PlayerController?
I manually spawned a PlayerController in the GameMode blueprint by using the “SpawnActor” node, then possessed a Pawn to it and set a Camera to the Pawn. But it seems the Camera I set is not being rendering. Is there any thing wrong with what I did above?
Do not set camera to pawn. Make new blueprint class that is pawn, add there camera as component (in editor). Then spawn that pawn and it will have camera attached. When you posses it view should be automatically switched to that pawn camera.
In my project I have a such structure:
Camera actor with the camera attached to it and full camera functionality
Player pawn with its own functionality (movement etc)
Player controller that controls both actors
Theoretically, you can have any amount of controllable actors, you can turn on/off them in runtime.
That’s pretty simple,
Camera pawn is the default pawn class in my game-mode
Separately from it, I spawn the player pawn
In runtime, I move the camera pawn to the player pawn and follow it
And my player pawn doesn’t have any camera, so there is no question about which camera is the main camera.
You means manually spawned a Camara as a Pawn? I spawned the Camera as an Actor, and maybe it is the reason that the Camera was not rendered.
But since I use the “Set View Target with Blend” to set an actor Camera to a Pawn, it worked!
Maybe I should spawn the Camera as a Pawn all the first.
It doesn’t matter, you can make a camera actor based on pawn or actor parent classes the key is which actor will be possessed.
In my case, my camera actor is the default pawn class