TheKingsRace/Assets/Scripts/PlayerScripts/PlayerCam.cs
Julia Butenhoff 2953687180 Fixed NetworkTransforms and Added Host IP
- Fixed placement of NetworkTransform on Prefab - Needs to be on the
  same level as the character controller and movement
- Added a display of the host IP address in the lobby
2021-11-03 14:03:43 -05:00

27 lines
629 B
C#

using System.Collections;
using System.Collections.Generic;
using MLAPI;
using UnityEngine;
public class PlayerCam : NetworkBehaviour
{
public GameObject player;
private Vector3 offset;
private Vector3 rad;
void Start ()
{
rad = (transform.position - player.transform.position);
}
void Update ()
{
if (!IsLocalPlayer) { return; }
offset = transform.parent.forward * rad.magnitude;
transform.position = new Vector3((player.transform.position.x - offset.x),((player.transform.position.y - offset.y)+2),(player.transform.position.z - offset.z));
}
}