using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FPSMover : MonoBehaviour
{
// public float mainSPEED;
public float x_sensi;
public float y_sensi;
public float trans_scale;
public GameObject target_camera;
void Start()
{
}
void Update()
{
// movecon();
if (Input.GetMouseButton(0))
{
cameracon();
}
if (Input.GetKey(KeyCode.W)) target_camera.transform.Translate(0.0f, trans_scale, 0.0f);
if (Input.GetKey(KeyCode.D)) target_camera.transform.Translate(trans_scale, 0.0f, 0.0f);
if (Input.GetKey(KeyCode.X)) target_camera.transform.Translate(0.0f, -trans_scale, 0.0f);
if (Input.GetKey(KeyCode.A)) target_camera.transform.Translate(-trans_scale, 0.0f, 0.0f);
if (Input.GetKey(KeyCode.S)) target_camera.transform.Translate(0.0f, 0.0f, trans_scale);
if (Input.GetKey(KeyCode.B)) target_camera.transform.Translate(0.0f, 0.0f, -trans_scale);
}
void cameracon()
{
float x_Rotation = Input.GetAxis("Mouse X");
float y_Rotation = Input.GetAxis("Mouse Y");
x_Rotation = x_Rotation * x_sensi;
y_Rotation = y_Rotation * y_sensi;
target_camera.transform.Rotate(0, x_Rotation, 0);
target_camera.transform.Rotate(-y_Rotation, 0, 0);
}
}