- Home /
photonView.isMine Problem [Help!]
So I'm trying to make it where only you can see your arms and stuff but not your character and other players can see your character but not your arms and stuff. This is my code so far (not all of it):
using UnityEngine;
using System.Collections;
public class FirstPersonNetwork : Photon.MonoBehaviour {
MouseLook cameraScript;
MouseLook cameraScript2;
CharacterMotor controllerScript;
Shot shotScript;
public GameObject camera;
public GameObject fpsView;
public GameObject tpsView;
void Awake () {
cameraScript = GetComponent<MouseLook>();
cameraScript2 = camera.GetComponent<MouseLook>();
controllerScript = GetComponent<CharacterMotor>();
shotScript = GetComponent<Shot>();
if (photonView.isMine == true)
{
this.camera.camera.enabled=true;
cameraScript.enabled = true;
cameraScript2.enabled = true;
controllerScript.canControl = true;
shotScript.enabled=true;
fpsView.active = true;
tpsView.renderer.enabled = false;
}
else
{
this.camera.camera.enabled=false;
cameraScript.enabled = false;
cameraScript2.enabled = false;
controllerScript.canControl = false;
shotScript.enabled=false;
fpsView.active = false;
tpsView.renderer.active = true;
}
gameObject.name = gameObject.name + photonView.viewID.ID;
}
However, when I test it, I can still see my character.
This is my setup:
FPS Controller (script attached to this) ----FPS Camera ----3rd Person Model
camera = FPS Camera fpsView = FPS Camera tpsView = Character Model
I'm trying to do the same thing, but without success. None of the demos I've found uses a first-person viewpoint (view from eyes of player). Can anyone point me to one that does?
Answer by supamigit · Jun 08, 2014 at 02:47 PM
Well isnt it more to do with the placement of the FPS camera that is embedded in the prefab of the player?
ie im doing Quils tutorial and made slight changes because i could see his head like i was inside it... not a good look
PlayerController (prefab that comes with Unity) - Top level stuff
- Transform -
no changes
- Character Controller -
Center Y to 1.001 (to make sure it doesn't start in the ground Radius of 0.36
PlayerController/Camera - Second level items
Transform-
Y to 1.66 gives the right head height (up/down)
Z to 0.15 give the right
forwardness to stop looking through
the face (forward/back)
Everything beyond that i left what it was, i am using the Soldier character from assets store with base firstperson prefab and then made those changes above to allow the camera not to show the HEAD like i was inside it... now for the body and arms im not 100% sure what you mean.. Hope this was something along the lines of what you needed..