x


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

more ▼

asked Dec 04 '10 at 01:00 PM

oinkoinkflapflap gravatar image

oinkoinkflapflap
193 42 54 66

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Feb 28 '11 at 02:37 PM

Meltdown gravatar image

Meltdown
5.6k 18 25 49

(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Feb 28 '11 at 02:44 PM

poncho gravatar image

poncho
932 2 3 14

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3014
x1047
x237
x101
x16

asked: Dec 04 '10 at 01:00 PM

Seen: 1390 times

Last Updated: Jul 16 '11 at 12:21 AM