- Home /
 
network camera big problem
Hi
I'm making a multiplayer fps based on Third Person Networking Sample. I can spawn many characters and kill each other, it works perfectly. But when someone die, automatically this dead player can see through other player camera. And when he respawn, the camera doesn't change...
I mean, after a player die, respawn and can't use it's real camera, but another player's camera.
Please, i must tell the game to never show the camera of another player.
Thanks you so much!
When the player dies, just make it keep their camera, and just destroy everything else, make everything else a child of their camera, then destroy the children.
Answer by Flynn · Jan 17, 2011 at 11:22 PM
Your game is instantiating a camera for every player. The oldest camera automatically renders on top, so when yoru player dies, his camera suddenly becomes the newest, and renders on the bottom, below your other cameras.
Having a camera for every player will seriously mess with your framerate, so you need to set your prefab to delete all but the proper camera.
In each prefab, add the following script:
C#:
public class CamDest : MonoBenaviour
{
public transform cam;
public void Start()
{
if (this.networkView.isMine == false)
{
Destroy(cam);
}
}
}
 
               
               JS:
public var cam : Transform;
public function Start()
{
if (this.networkView.isMine == false)
{
Destroy(cam);
}
}
 
               
               Hope this helps -- Flynn
EDIT: Written from memory, untested. May require tweaking.
Your answer
 
             Follow this Question
Related Questions
Lerping Field Of View is buggy 1 Answer
Networking Camera 1 Answer
How to get the camera to hold the gun? 1 Answer
Set Max Rotation On Weapon Sway 0 Answers
HDRP Camera weapon layer 1 Answer