synchronize the rotation
Options
Hi everyone, I'm starting with Photon. I wanted to understand how I can synchronize a rotation. In my game I have 2 players who rotate their weapon in the direction of the mouse. This is the code I made for the single player. I should do a PUN function for rotation so that each player sees where the other is pointing. How should i do?
void Update() { mousePos = Camera.main.ScreenToViewportPoint(Input.mousePosition); posScreen = Camera.main.WorldToViewportPoint(gunPivot.position); mousePos.z = 0; Vector3 dir2 = (posScreen - mousePos).normalized; gunPivot.rotation = Quaternion.LookRotation(Vector3.forward, mousePos - posScreen) * Quaternion.Euler(0,0,90); Debug.DrawRay(gunPivot.position, dir2 * 10, Color.red); }
0
Comments
-
Just slam a PhotonView and TransformView on your Weapon gameObject.
https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial/player-networking0 -
but and is the child of an object that moves I have to apply the photon view to both the player and the child?0