- Home /
How to make your camera move to the middle of the player photon c#?
This is the script I'm using:
using UnityEngine;
public class FollowPlayer : MonoBehaviour {
public Transform player;
public Vector3 offset;
// Update is called once per frame
void Update()
{
transform.position = player.position+offset;
transform.eulerAngles = player.eulerAngles;
}
}
Answer by MilitaryG · Jan 06 at 03:04 PM
[Command]
public void(GameObject Me, Vector3 v){
Me.transform.position = v;
TargetMove(Me.GetComponent<NetworkIdentity>().connectionToClient)
}
that's how to send data to server
to send data to specific client
[TargetRpc]
public void TargetMove(NetworkConnection Target, Vector3 v)
{
transform.position = v;
}
that's robust code and is only ment to send data or recieve data from single pc. server-client
don't forget it has to be in : NetworkBehaviour
abstract class
I'm using mirror
asset witch is free
Answer by KloverGames · Jan 08 at 04:00 AM
You need to use the PhotonView component so that only your camera moves, not any other players
Your answer
Follow this Question
Related Questions
How would I continue an object's movement in the same direction as per last user input? 1 Answer
How do I do left to right movement with ONLY the WASD keys? 1 Answer
How to handle movement in a multiplayer FPS? 0 Answers
Can I change movement from Unity 3d into Unity 3D iOS 2 Answers
Unity networking tutorial? 6 Answers