35 lines
836 B
C#
35 lines
836 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
//using System.Numerics;
|
|
|
|
public class CameraMove : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
Vector3 Forward;
|
|
float a = 0;
|
|
Vector3 normal;
|
|
//public float ww = 0;
|
|
float max = 0.55f;
|
|
float min = -0.3f;
|
|
float normalF = 0;
|
|
public bool CanMove;
|
|
void Start()
|
|
{
|
|
Forward = gameObject.transform.forward;
|
|
normal = gameObject.transform.position;
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (CanMove)
|
|
return;
|
|
if ((a = Input.GetAxis("Mouse ScrollWheel")) == 0) return;
|
|
if (normalF + a < min || normalF + a > max) return ;
|
|
normalF += a;
|
|
gameObject.transform.position = normalF * Forward + normal;
|
|
}
|
|
}
|