You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SiegeSong;
namespace SiegeSong
{
public class HeadTurn : MonoBehaviour
{
public Transform HeadBone;
public Transform RibcageBone;
public Transform LookTarget;
public CameraManager CameraManager;
public Motor Motor;
public Vector3 EulerAngleOrigin = new Vector3();
public float XMin = 0.0f;
public float XMax = 0.0f;
public float YMin = 0.0f;
public float YMax = 0.0f;
private float rotationResetDuration = 0.6f;
private float rotationResetStartedTimeStamp = 0.6f;
void Start()
{
}
void LateUpdate()
{
//if (Motor.Moving == false)
//{
// var direction = new Vector3(1, -1, 1);
// if (LookTarget == null)
// direction = new Vector3(
// (CameraManager.ActiveCamera.transform.rotation.eulerAngles.x + rotationXOffset) * rotationXModifier,
// (CameraManager.ActiveCamera.transform.rotation.eulerAngles.y + rotationYOffset) * rotationYModifier,
// -CameraManager.ActiveCamera.transform.rotation.eulerAngles.z * rotationZModifier);
// else
// direction = LookTarget.position - HeadBone.position;
// var resetingHeadTurn = true;
// if (direction.y - rotationYOffset > rotationYMax)
// {
// previousY = direction.y;
// resetingHeadTurn = false;
// }
// if (direction.y + rotationYOffset < rotationYMin)
// {
// previousY = direction.y;
// resetingHeadTurn = false;
// }
// if (resetingHeadTurn)
// {
// direction.y = previousY;
// resetingHeadTurn = false;
// }
// else
// {
// HeadBone.eulerAngles = direction;
// }
// HeadBone.eulerAngles = CameraManager.ActiveCamera.transform.rotation.eulerAngles;
//}
}
}
}