Download

How do I possess a flycam in the game?

Here’s what I want to do, I want to possess a flycam, (switch from third person character to the flycam.) when I hit the C key and take control of the flycam to move it around the screen. and then switch back again into my third person char player pawn
to take possesion of it again when finished using it. Later on i will put a timer on the flycam. I don’t quite know how to set up the code for possessing the flycam pawn and then switching back again to posess the third person pawn. can anyone help ?

I believe the node you want is called “Possess Pawn” and it take the player controller - check out this doc - https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/PossessPawns/Blueprints/

Yes that will help, this deals with pawns that are already existing in the level. But my flycam needs to spawn first into the level and then take possession. I also want the flycam to use the same axis keys W A S D for the camera movement as I use for my third character pawn. I think I have to locate in the third person char blueprint where those key events names are because they were set up originally in the key bindings in the project settings and then copy those events and the camera movement code
into the Flycam’s blueprint and that should work (I hope) but I’m only taking a guess.

Later on I will need to add a bar to deplete the time that the flycam remains active.

But to get a little more advanced once I got it that working, I might allow the flycam to play
audio messages from the Ship’s computer from time to time or maybe play a little movie
on the flycam viewport if the computer needs to show something. And when the viewport is not in
use, it has a blue glowing holograph Fresnel edge effect. The flycam won’t be spinning all around
but be stationary in the air.

Yes that will help, this deals with pawns that are already existing in the level or if you
drap and drop the character object into the map.

But there’s just one issue, my flycam needs to spawn into the level first as soon as the
C key is pressed and then take possession of the flycam. So I can’t select it from the world
outliner as this document tells you to because the flycam hasn’t even been spawned first
into the level yet.

I’ve already added the camera WADS and mouse movement code into the flycam’s
blueprint using the default keybinds as defined in my project settings. Now I just need
to spawn in the flycam into the level and then take control of it. And another Key to
toggle back to my main player pawn again using a flip flop node.

Later on I will need to add a widget with a timer bar to deplete the time that the
flycam remains active.

I’ve also added an interface to allow me to use the flycam also in other blueprints
or other game level maps because I don’t want to just use the flycam for just
one single map but for all maps…

But to get a little more advanced once I got the flycam working, I might allow the flycam to play
audio messages from the Ship’s computer from time to time or maybe play a little movie
on the flycam viewport if the computer needs to show something visual. (I also have the text dialog data table in the game set up) if it just to be only a text message. The flycam won’t be spinning all around but be stationary in the air.

use the node get all actors of class(the actor you spawned) then use that as the reference to do things to.
also use the is valid node to make sure you are possessing a valid object.

if you possess a different actor your flipflop wont work. because 1 actor will make you posses the flycam or watever inside the flycam you will need to have the same event that then posseses the player again.

unless you are doing this event in the controller and not the character blueprint etc.

Inside the third person character

e6a718d2808f414b9527d478d34cdbce.png

inside the flycam actor

266bc04cedb61fadba9100e0122d35ebb36334f5.png

then add the same movement nodes inside the flycam as your third person character !

look at my last post above.

in the flycam blueprint those two nodes Get and Posess both linked up together with no
conflict, they just won’t do the same thing in the third person blueprint and I don’t even
know why… The only way I resolved this error was to connect up the Return value pin of Spawn Actor
up to the Posess node Pawn In Pin. Now I can beable to move my PAWN around.
But for some unknown reason, It will not let me connect the get pin up to the posess pawn node
on third person char I don’t know why if its to do with having an older engine version, maybe the
nodes had been changed because I’m using 14.4… But at least the pawn is now moving around
even though its stuck down the bottom in front of the camera so I have to position it in the
viewport and further away from the camera.

Now the last problem left to resolve is when I toggle the C key again, the pawn then dissapears
and I am left unable to move around on the game screen, so it hasn’t returned it back to
posess the third person char pawn again.

you have them reversed. you are deleting the third person character with the destroy node. this should be inside the flycam actor

and make sure your Char variable inside the flycam is a thirdperson Class not just a reference

also you should make the flycam a pawn since you want it to be able to move etc. remake your flycam using pawn as the blueprint type

an “actor” is the base Object and a pawn is an extended version of an actor that adds the movement/ posses actions. a character extends the function of pawn etc.

when you make your new pawn hover over the different types of actor/pawn/character/controller and the tool tips should show you what i mean <3

im sorry i keep saying actor but i mean to say pawn :frowning: my bad

“also you should make the flycam a pawn since you want it to be able to move etc. remake your flycam using pawn as the blueprint type”"

Ok I redid the flycam character blueprint from scratch by turning it into a pawn blueprint.

but I cannot access the third person class for changing the char variable in the flycam’s blueprint.
The third person class is not avaliable in the classes list. All that I can access is just
Blueprints Class or the Tutorials Class references types. And only Tutorials Class will link
up with the Get All Actors node or I get a pin error if I try to link up the Blueprints Class, i
can’t even access the third person class type.

All i can do is just move the flycam around after possessing it, But I hit the c key again, the screen just goes all dead and I cannot move anything after that.

So how am i gonna get back again into my third person pawn ???

please let me know if you have another issue from it as I’m using 4.15 and there could be a few changes I don’t know about that could cause an issue
hope that help you!!! <3 keep coding and learning. and ask questions its how we learn!

in the pawn set the camera to a position you want it to face and hight you want it to be this way its not at the characters feet when spawned etc.

the spawn transform location in the spawn actor of class should be set to the position you want it to spawn at i just used the characters location and added 5 to the x to put it behind him. you might also want to split the struct and set its rotation as well

you need to make a variable named char then set it like this

see in the context menu where it says class? set to class not a reference
daf3afc10efe4b6f840a5fbc52590851.png

when you type third you dont want to click it. just hover over third person blueprint and you will see Class under reference like in my image <3
click on class and it will be a purple guy icon.

A) Redo the Flycam blueprint all over again and in the blueprint classes select
PAWN as the Blueprint type instead of choosing Character Blueprint.

steps:

make a “PAWN” named flycam. add a variable like in my above image called char, set it as a third person character Class variable type. then do the coding in the flycam picture
then go into thirdperson character and do the code i showed there.

Possession tutorial project ue4 4.15 here is how i got it to work. using 2 character blueprints. oddly the movement was not working using the pawn but it SAYS IT CAN MOVE LOL FIX IT EPIC