I saw a video where the player saw themselves through a camera attached to a npc that follows the player around. I made an npc follow the player, but cant figure out how to use the npc cam
You can place a new camera that’s fixed to the NPC’s head bone, making it move and rotate depending on where it’s looking at. Then you can use the “Set Active” node to determine which cameras will be valid once you trigger the camera switch.
am i able to make the npc camera the default?
Yes of course! When you click on your newly added camera, you could scroll down a bit and find a setting called “Auto Activate for Player” but it should be disabled. Change it to be Player 0
Your camera switching mechanism seems fine, that error message indicates that there’s a problem with your casting. Can you show:
- How did you declare that object type variable for the NPC camera
- Where did you place the camera for the NPC
- The camera’s placement under the hierarchy and it’s dependencies
the cast to npc cam is off the end of event begin play in my character bp, the tut I watched for an nps that follow you just had me duplicate the player bp for the npc. auto activate is checked for the npc cam and not the player cam.
I think that cast is failing since you put the player character into it’s object pin. You can check that by placing a print string node after the fail pin.
did that and nothing printed, what should be plugged into object instead?
Not just for that, but you can use the “Get All Actors of Class” node for pretty much all the castings under the same class
sorry, im still really new so im not quite understanding. how would i use that in this case?
Place that node, choose your class, drag a “Get” node from it’s out actors pin and finally plug that into the object pin of your cast to node. There were other nodes you could use in this situation as well, like the “Get Owner” node, but I wanned to make sure that the cast works. You can check if that object type variable of yours gets set to the expected object by printing it out.
i still cant seem to get it to work. Should the class be the npc blueprint or camera actor or something else? should i be using a camera actor dropped in the world and somehow attached to the npc, or a camera component in the npc blueprint? and if i drag out of out actors, i cant ‘get’ anythng, and i cant connect it to the cast