40 lines
914 B
C#
40 lines
914 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// ǯÐÎǯÐεçÁ÷±í
|
|
/// </summary>
|
|
public class ClampAmmeters : MonoBehaviour
|
|
{
|
|
//private Vector3 offset;
|
|
//public void MouseDown()
|
|
//{
|
|
// offset = GetMouseWorldPos();
|
|
//}
|
|
Vector3 pos;
|
|
public bool isok = false;
|
|
public void MouseDrag()
|
|
{
|
|
|
|
}
|
|
public void Update()
|
|
{
|
|
if (Input.GetMouseButton(0))
|
|
{
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
RaycastHit hitInfo;
|
|
|
|
if (Physics.Raycast(ray, out hitInfo))
|
|
{
|
|
if (pos!= hitInfo.point)
|
|
{
|
|
transform.GetComponent<BoxCollider>().isTrigger= true;
|
|
transform.position = hitInfo.point;
|
|
pos = hitInfo.point;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|