- Home /
changing player (getting in vehicles)
Oi! unity people! if i have 1 player (the main one with a main camera) and have it so if I'm close enough i can push a button and change player and camera (so my guy disappears or is deactivated or something and i take over the controls of another) then push this button again and my character re-appear next to were i take this controller and the controller stay there.... basically this is for vehicles. kind of like a gta or halo or whatever and get into any vehicles and get out and carry on. thanks 4 your time :D.
scripts would be appreciated :D
Answer by Meltdown · Feb 28, 2011 at 02:37 PM
Create a general script for your game that lets you keep track of the currently active player and camera.
Then in that same script, check if your 'change player' button is pressed, then simply activate the relevant camera, and character controller.
Answer by poncho · Feb 28, 2011 at 02:44 PM
well, is just as you are asking " change player and camera (so my guy disappears or is deactivated or something and i take over the controls of another) then push this button again and my character re-appear next to were i take this controller and the controller stay there.... "
if you have 2 cameras, 1 following your "main player" and the other on the vehicle, when you get near the vehicle, and press the button you choose, make a script to deactivate the camera on the player, and the player, then activate the vehicle and the camera of the vehicle, just a couple of booleans can make the trick
and that was all you need, no scripts this time, this one would be better to learn on your own, but the pseudocode you have it, try to make your thoughts to script and you'll be on the right way
hope this helps
Your answer
Follow this Question
Related Questions
character switching on collision 1 Answer
View and control script broken? 1 Answer
switch character 1 Answer
How to switch between four characters when a button is pressed? 1 Answer
switching between in game characters 2 Answers