49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System;
|
|
using Invector.vCamera;
|
|
using UnityEngine;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class bThirdPersonCamera : vThirdPersonCamera
|
|
{
|
|
private static bThirdPersonCamera _instance;
|
|
public static new bThirdPersonCamera instance
|
|
{
|
|
get
|
|
{
|
|
return _instance;
|
|
}
|
|
}
|
|
private void Awake()
|
|
{
|
|
if (_instance == null)
|
|
{
|
|
_instance = this;
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("bThirdPartyCamera already exists!");
|
|
Destroy(gameObject);
|
|
}
|
|
//#if !MOBILE_INPUT
|
|
// Cursor.lockState = CursorLockMode.Locked;
|
|
//#endif
|
|
}
|
|
public Vector3 GetCameraTargetPosition(bool useDefaultRotation)
|
|
{
|
|
if (currentTarget)
|
|
{
|
|
var camDir = (currentState.forward * targetLookAt.forward) + ((currentState.right * currentSwitchRight) * targetLookAt.right);
|
|
camDir = camDir.normalized;
|
|
var targetPos = new Vector3(currentTarget.position.x, currentTarget.position.y, currentTarget.position.z) + currentTarget.transform.up * offSetPlayerPivot;
|
|
current_cPos = targetPos + currentTarget.transform.up * currentHeight;
|
|
return current_cPos + (camDir * (distance));
|
|
}
|
|
else
|
|
{
|
|
return transform.position;
|
|
}
|
|
}
|
|
|
|
}
|
|
} |