Adding a 2nd user controlled camera

I’m more of an artist than a coder and I’m currently working on a FPS. I’m obviously not looking for anyone to write the code for me, just kind of get me on the right track.

So I’m trying to implement drones essentially. The situation I’m trying to create is, a user hits number 5 on their keypad. Their current first person camera changes to the camera controlling the drone. However, when the drone is killed (reaches 0 HP), the camera goes back to the users original first person camera and the movements a user makes while operating the drone also don’t move the original camera, it just freezes that controller.

Not sure if that was exactly clear - it makes sense in my head anyways.
If anyone could get me on the right track I’d greatly appreciate the help! Thank you

Well, you’re going to have to adapt a few different types of code together.

To switch cameras, here’s a question from the Answers section:

Then you’ll have to make the Main Camera be disabled, and either activate the camera on the drone or it’ll be activated anyways if you Instantiate it the right way.

To make sure the player doesn’t move, you’re going to need a flag (a bool variable to check the state of something). So, when you press the Drone key, a flag (such as “DisablePlayerAction”) will be set to true (and also the Main Camera would be disabled).

In your Controller script for the player, you would have an if statement that checks if DisablePlayerAction is true. If it is true, you would skip all those parts that control player action. (There may be a few more elegant ways to actually do this, but this is pretty simple)

Well, all of this is just to get to switch between Player and Drone. You also need to program the life of the Drone and, when the HP is 0, destroy/deactivate the drone, disable/destroy the drone camera, reenable the Main Camera, and also set DisablePlayerAction to false.

If you got any more in-depth questions about switching between them, feel free to ask. I’m pretttty sure my “explanation” probably didn’t cover it all. :smile: