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





public class CameraScript : MonoBehaviour
{
    public GameObject character;
    private Transform charTransform;
    public float height = 5f;
    public float distance = 5f;
    public float speed = 5f;
    private float vertLock;
    private CamStates camState;

    #region properties
    public enum CamStates
    {
        Locked,          // Locked to other player
        Free            // Free to move wherever
    }

    public CamStates CamState
    {
        get
        {
            return this.camState;
        }
    }
    #endregion
    void Start()
    {
        charTransform = character.transform;
        camState = CamStates.Free;
        //vertLock = this.transform.position.y + height;
    }
    void LateUpdate()
    {
        // TODO      Pull values from controller/keyboard to check if Cam state should be Locked
        switch (CamState)
        {
            case CamStates.Free:
                Vector3 targetPoint = charTransform.position;
                //you need to rotate the camera around the center of the sphere, the opposite of rot        
                Vector3 follow = targetPoint + charTransform.up * height - charTransform.forward * distance;
                transform.position = Vector3.Lerp(transform.position, follow, Time.deltaTime * speed);
                //transform.position = new Vector3(this.transform.position.x, vertLock, this.transform.position.z);

                transform.LookAt(targetPoint);
                break;
            default:
                break;

        }
        // make camera look at center of sphere
        //rotatingCamera.transform.LookAt(transform.position);
    }


}<commit_msg>implemented camera movement control<commit_after>﻿using UnityEngine;
using System.Collections;





public class CameraScript : MonoBehaviour
{
    public GameObject character;
    private Transform charTransform;
    public float height = 5f;
    public float distance = 5f;
    public float speed = 5f;
    private float vertLock;
    private CamStates camState;

    #region properties
    public enum CamStates
    {
        Locked,          // Locked to other player
        Free            // Free to move wherever
    }

    public CamStates CamState
    {
        get
        {
            return this.camState;
        }
    }
    #endregion
    void Start()
    {
        charTransform = character.transform;
        camState = CamStates.Free;
        //vertLock = this.transform.position.y + height;
    }
    void LateUpdate()
    {
        // TODO      Pull values from controller/keyboard to check if Cam state should be Locked
        switch (CamState)
        {
            case CamStates.Free:
                Vector3 targetPoint = charTransform.position;
                //you need to rotate the camera around the center of the sphere, the opposite of rot        
                Vector3 follow = targetPoint + charTransform.up * height - charTransform.forward * distance;
                transform.position = Vector3.Lerp(transform.position, follow, Time.deltaTime * speed);
                //transform.position = new Vector3(this.transform.position.x, vertLock, this.transform.position.z);

                transform.LookAt(targetPoint);
                break;
            default:
                break;

        }
        // make camera look at center of sphere
        //rotatingCamera.transform.LookAt(transform.position);
    }


    //TODO add correct axis to this
    private void moveCamera()
    {
        float xAxisValue = Input.GetAxis("Horizontal");
        float zAxisValue = Input.GetAxis("Vertical");
        if (Camera.current != null)
        {
            Camera.current.transform.Translate(new Vector3(xAxisValue, 0.0f, zAxisValue));
        }
    }

}
{'fraction_non_alphanumeric': 0.07422895974908521, 'fraction_numerical': 0.004443282801881861, 'mean_word_length': 1.8666666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7529508', 'n_tokens_mistral': 990, 'n_tokens_neox': 942, 'n_words': 285}