Question by
YargonIV · Apr 24, 2018 at 04:34 PM ·
networkinginputmultiplayernetworkgyroscope
Problem with Input.gyro in LAN network Unet
Hello, Like I said the Input.gyro got a problem with networking with Unity Network system ... Unity consider that the gyroscope is the HOST gyroscope whereas want to take input from client to move the PlayerPrefab. Here is my code :
void Start () {
if (hasAuthority == true)
{
gyro = Input.gyro; //the problem begins here i think
gyro.enabled = true;
gyroEnabled = true; //my bool variable to know if it's already enable
}
}
void Update () {
if ( hasAuthority == true & gyroEnabled == true)
{
phoneRotation = gyro.attitude .eulerAngles;
this.transform.localPosition = Pos;
this.transform.localPosition = new vector 3 (Pos.x+(phoneRotation.x*speed),Pos.y+(phoneRotation.y*speed),Pos.z+(phoneRotation.z*speed));
//Debug.Log(gyro.attitude.eulerAngles);
}
}
Comment
Your answer
Follow this Question
Related Questions
only game host can damage clients 1 Answer
Unity Photon doesn't Spawn Player 0 Answers
How to use a script to control the nickname of online players 0 Answers
How do I sync Rigidbody2D over the network? 0 Answers
Flip Character Direction Networking 0 Answers