<commit_before>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour {

    private Transform elevator;

    private void Awake() {
        elevator = GameObject.FindGameObjectWithTag("Player").transform;
    }
    private Vector3 velocityCameraFollow;
    public Vector3 cameraPosition = new Vector3(0, 0, -4);

    
    private void FixedUpdate() {
        //transform.rotation = Quaternion.Euler(new Vector3(angle, ourDrone.GetComponent<DroneMovement>().currentYRotation, 0));
        LookAround();
    }

    public float smoothTime = 0.5f;
    void ReturnToPlayer() {
        transform.position = Vector3.SmoothDamp(transform.position, elevator.transform.TransformPoint(cameraPosition), ref velocityCameraFollow, smoothTime);
    }


    private float velocityCameraAngle;
    private float mouseMovementx = 0f;
    private float mouseMovementy = 0f;
    public float holdTime = 1f;
    void LookAround() {
        float mouseXInput = Mathf.Abs(Input.GetAxis("Mouse X"));
        float mouseYInput = Mathf.Abs(Input.GetAxis("Mouse Y"));
        if (mouseXInput > mouseMovementx) {
            mouseMovementx = Input.GetAxis("Mouse X");
        }
        if (mouseYInput > mouseMovementy) {
            mouseMovementy = Input.GetAxis("Mouse Y");
        }
        Vector3 pos = transform.position + (Vector3.up * Input.GetAxis("Mouse Y")) + transform.position + (Vector3.right * Input.GetAxis("Mouse X"));
        gameObject.transform.position = pos;
        //angle = Mathf.SmoothDamp(angle, desiredAngle, ref velocityCameraAngle, 0.25f);

    }

    public float scale(float OldMin, float OldMax, float NewMin, float NewMax, float OldValue) {
        float OldRange = (OldMax - OldMin);
        float NewRange = (NewMax - NewMin);
        float NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin;
        return (NewValue);
    }
}
<commit_msg>camera controller works. might wanna put a limit on it<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour {

    private Transform elevator;

    private float mouseXInput;
    private float mouseYInput;
    private bool lookingAround = false;

    private void Awake() {
        elevator = GameObject.FindGameObjectWithTag("Player").transform;
    }

    private Vector3 velocityCameraFollow;
    public Vector3 cameraPosition = new Vector3(0, 0, -4);
    
    private void FixedUpdate() {
        //transform.rotation = Quaternion.Euler(new Vector3(angle, ourDrone.GetComponent<DroneMovement>().currentYRotation, 0));
        lookingAround = GetInput();
        if (!lookingAround) {
            if (Time.time >= returnTime) {
                ReturnToPlayer();
            }
        }
        LookAround();
    }

    public float returnDelay = 3f;
    private float returnTime;
    bool GetInput() {
        mouseXInput = Input.GetAxis("Mouse X");
        mouseYInput = Input.GetAxis("Mouse Y");
        if ((mouseXInput != 0) || (mouseYInput != 0)) {
            returnTime = Time.time + returnDelay;
            return true;
        }
        return false;
    }
    
    void LookAround() {
        Vector3 pos = transform.position;
        transform.position = new Vector3(pos.x + (1 * Input.GetAxis("Mouse X")), pos.y + (1 * Input.GetAxis("Mouse Y")), cameraPosition.z);
    }

    public float smoothTime = 0.5f;
    void ReturnToPlayer() {
        Debug.Log("Returning to Player");
        transform.position = Vector3.SmoothDamp(transform.position, elevator.transform.TransformPoint(cameraPosition), ref velocityCameraFollow, smoothTime);
    }




    public float scale(float OldMin, float OldMax, float NewMin, float NewMax, float OldValue) {
        float OldRange = (OldMax - OldMin);
        float NewRange = (NewMax - NewMin);
        float NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin;
        return (NewValue);
    }
}

{'fraction_non_alphanumeric': 0.10707121364092277, 'fraction_numerical': 0.009528585757271816, 'mean_word_length': 2.88412852969815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1666657', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1112, 'n_words': 285}