37 lines
881 B
C#
37 lines
881 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITKit;
|
|
using UnityEngine;
|
|
|
|
namespace BITFALL.HotFix
|
|
{
|
|
public class FPVScaleFix : MonoBehaviour
|
|
{
|
|
[SerializeField] private Transform fpvScale;
|
|
[SerializeField] private Transform center;
|
|
[SerializeField] private Optional<Transform> viewFix;
|
|
|
|
private void Update()
|
|
{
|
|
fpvScale.localScale = Vector3.zero;
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
fpvScale.localScale = Vector3.zero;
|
|
if (viewFix.Allow)
|
|
{
|
|
// var direction = viewFix.Value.position - center.position;
|
|
// direction = Vector3.ProjectOnPlane(direction, Vector3.up);
|
|
// var position = center.position;
|
|
// position -= direction.normalized * 0.8f;
|
|
// position.y = viewFix.Value.position.y;
|
|
// fpvScale.position = position;
|
|
fpvScale.position = viewFix.Value.position - center.forward;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|