private void FixedUpdate() { if (photonView.IsMine) { if (followPlane) { controller.position = followPlane.TransformPoint(onPlanePositionLS); controller.rotation = followPlane.rotation * onPlaneRotationLS; controller.SetAttach(followPlane, Vector3.zero); anim.SetInteger("State", 2); } else if (followPlayer) { Vector3 newPos = followPlayer.position + followPlayer.rotation * followBias; Vector3 delta = controller.SweepCollider(newPos - transform.position, slide: true, out bool isHit, out RaycastHit hit); Vector3 newForward = Vector3.ProjectOnPlane(delta, Vector3.up); if (newForward.magnitude > 0) { transform.rotation = Quaternion.LookRotation(newForward.normalized, Vector3.up); } transform.position += delta; controller.ResolveCollision(false); controller.SetAttach(null, Vector3.zero); anim.SetInteger("State", 1); } else { controller.SetAttach(null, Vector3.zero); anim.SetInteger("State", 0); } } }