Настроенные авто
This commit is contained in:
@ -24,7 +24,6 @@ namespace RootMotion
|
||||
|
||||
[Header("Position")]
|
||||
public bool smoothFollow; // If > 0, camera will smoothly interpolate towards the target
|
||||
public Vector3 offset = new Vector3(0, 1.5f, 0.5f); // The offset from target relative to camera rotation
|
||||
public float followSpeed = 10f; // Smooth follow speed
|
||||
|
||||
[Header("Rotation")]
|
||||
@ -45,7 +44,6 @@ namespace RootMotion
|
||||
public float blockingRadius = 1f;
|
||||
public float blockingSmoothTime = 0.1f;
|
||||
public float blockingOriginOffset;
|
||||
[Range(0f, 1f)] public float blockedOffset = 0.5f;
|
||||
|
||||
public float x { get; private set; } // The current x rotation of the camera
|
||||
public float y { get; private set; } // The current y rotation of the camera
|
||||
@ -59,7 +57,6 @@ namespace RootMotion
|
||||
private float fixedDeltaTime;
|
||||
private Quaternion r = Quaternion.identity;
|
||||
private Vector3 lastUp;
|
||||
private float blockedDistance = 10f, blockedDistanceV;
|
||||
|
||||
//Rotation
|
||||
|
||||
@ -79,31 +76,19 @@ namespace RootMotion
|
||||
// Initiate, set the params to the current transformation of the camera relative to the target
|
||||
protected virtual void Awake()
|
||||
{
|
||||
Vector3 angles = transform.eulerAngles;
|
||||
x = angles.y;
|
||||
y = angles.x;
|
||||
//Vector3 angles = transform.eulerAngles;
|
||||
//x = angles.y;
|
||||
//y = angles.x;
|
||||
|
||||
distanceTarget = distance;
|
||||
smoothPosition = transform.position;
|
||||
|
||||
cam = GetComponent<Camera>();
|
||||
|
||||
//_rotate = new Controller();
|
||||
//_rotate.Player.CameraRotation.performed += context => UpdateInput();
|
||||
|
||||
|
||||
//lastUp = rotationSpace != null ? rotationSpace.up : Vector3.up;
|
||||
|
||||
}
|
||||
|
||||
//private void OnEnable()
|
||||
//{
|
||||
// _rotate.Enable();
|
||||
//}
|
||||
|
||||
//private void OnDisable()
|
||||
//{
|
||||
// _rotate.Disable();
|
||||
//}
|
||||
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
@ -174,33 +159,11 @@ namespace RootMotion
|
||||
// Distance
|
||||
distance += (distanceTarget - distance) * zoomSpeed * deltaTime;
|
||||
|
||||
// Smooth follow
|
||||
if (!smoothFollow) smoothPosition = target.position;
|
||||
else smoothPosition = Vector3.Lerp(smoothPosition, target.position, deltaTime * followSpeed);
|
||||
|
||||
// Position
|
||||
Vector3 t = smoothPosition + rotation * offset;
|
||||
Vector3 f = rotation * -Vector3.forward;
|
||||
|
||||
if (blockingLayers != -1)
|
||||
{
|
||||
RaycastHit hit;
|
||||
if (Physics.SphereCast(t - f * blockingOriginOffset, blockingRadius, f, out hit, blockingOriginOffset + distanceTarget - blockingRadius, blockingLayers))
|
||||
{
|
||||
blockedDistance = Mathf.SmoothDamp(blockedDistance, hit.distance + blockingRadius * (1f - blockedOffset) - blockingOriginOffset, ref blockedDistanceV, blockingSmoothTime);
|
||||
}
|
||||
else blockedDistance = distanceTarget;
|
||||
|
||||
distance = Mathf.Min(distance, blockedDistance);
|
||||
}
|
||||
|
||||
position = t + f * distance;
|
||||
|
||||
// Translating the camera
|
||||
transform.position = position;
|
||||
|
||||
|
||||
}
|
||||
|
||||
transform.rotation = rotation;
|
||||
//transform.rotation = rotation;
|
||||
}
|
||||
|
||||
// Zoom input
|
||||
|
@ -110,7 +110,7 @@ public class DriftScore : MonoBehaviour
|
||||
|
||||
void ManageUI()
|
||||
{
|
||||
totalScoreText.text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: " + (totalScore).ToString("###,###, ##0");
|
||||
totalScoreText.text = "<22><><EFBFBD><EFBFBD>: " + (totalScore).ToString("###,###, ##0");
|
||||
factorText.text = driftFactor.ToString("###,###,##0.0") + "X";
|
||||
currentScoreText.text = currentScore.ToString("###,###,000");
|
||||
driftAngleText.text = driftAngle.ToString("###,##0");
|
||||
|
Reference in New Issue
Block a user