- Home /
camera spectator mode multiplayer
I want to create multiple spectator for multiplayer gaming. how can I do? I tried to use network view, but how to set it?
this is my script, but it does not work, because every time a new player join the game unity creates a new camera, which becomes the maincamera for all players.
You should make sure then that your camera prefab is tagged with "Untagged" as opposed to "$$anonymous$$ain Camera".
thanks for the answer, but the camera prefab has already been tagged as untagged
Answer by JayMHelpsU · Apr 11, 2012 at 10:22 AM
You need to make an updater, you will need to add tag to both the Player being spectated and your camera var playerx : Int var playery : Int var playerz : Int var Xoffset : Int var Yoffset : Int var Zoffset : Int var CurrentPlayer : Int function Update() if (CurrentPlayer == 1) { var POS1 = GameObject.FindWithTag("PlayerPos"); //being spectated playerx = POS1.transform.position.X playery = POS1.transform.position.y playerz = POS1.transform.position.z var POS = GameObject.FindWithTag("CameraToSee"); //set the camera POS.transform.position = Vector3(playerx + Xoffset,playery + yoffset,playerz + Zoffset) // make the cam go here } {
i hope this help, tell me if there is any errors (REMEMBER TO BACKUP YOUR CURRENT CODE)
thanks a lot! which object should I associate this script?
I'm a bit confused about what your script should make ..
Sorry the add code screwed up :/ $$anonymous$$y script constantly moves to a certain player in mulitplayer, you can add and change the Player id (CurrentPlayer) hmmm looking back on this it looks a bit messed, ill try and edit it and fix it for you. Sorry for any inconvenience
Your answer
Follow this Question
Related Questions
TPS camera in multiplayer... 2 Answers
Have Camera Render First Person Arms But Not Body. 2 Answers
2 players 1 game field in shooter/card game 0 Answers
Multiplayer click and spawn 1 Answer
Centering camera between 4 players 2 Answers