目录
同时控制旋转平移
using ServerCommunication;
using System;
//using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class TestControllerTranslation : MonoBehaviour
{
public TCPIP_Base m_TCPIP_Base;
public GameObject obj_grabble;
public GameObject obj_grabble_parent;
RaycastHit hitInfo;
public GameObject controller;
LineRenderer lRend2;
public bool objSelected = false;
// GameObject obj_asymetric_operation;
//define the ralative space for object movement
//central eye: CenterEyeAnchor
public GameObject cam;
//OvrCamera
public GameObject obj_VRCamera;
public GameObject m_objRayStartPoint;
// CURRENT_SCENR m_currentScene = CURRENT_SCENR.BIMANUAL_OPERATION;
public GameObject obj_blueBackground;
public GameObject obj_virtualCamera;
// bool m_phoneInputEnabled = false;
bool m_controllerInputEnabled = false;
// public GameObject m_finishAlignedModel;
// bool m_objAlignedCkeck = false;
// public GameObject m_finishAlignedText;
bool m_last_controllerInput_status = false;
public GameObject temp;
public double fps = 0;
GameObject m_currentOperatingModel;
// Start is called before the first frame update
void Start()
{
if (m_TCPIP_Base == null)
{
try
{
m_TCPIP_Base = GetComponent<TCPIP_Base>();
}
catch (System.Exception)
{
Debug.LogError("No baes tcpip class");
ExitApp();
return;
}
}
if (m_TCPIP_Base == null)
{
Debug.LogError("PLease set base tcpip class");
ExitApp();
return;
}
m_TCPIP_Base.OnProcessingData += ProcessingData;
lRend2 = controller.AddComponent<LineRenderer>();
lRend2.SetWidth(0.002f, 0.002f);
}
private void Update()
{
fps = 1.0 / Time.deltaTime;
Vector2 controllerStick = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
if (Mathf.Abs(controllerStick.x) > 0.01 || Mathf.Abs(controllerStick.y) > 0.01)
{
// obj_VRCamera.transform.Translate(controllerStick.x / 100, 0, controllerStick.y / 100, cam.transform);
Vector3 projectedVector = cam.transform.forward * controllerStick.y / 100 + cam.transform.right * controllerStick.x / 100;
obj_VRCamera.transform.Translate(projectedVector.x, 0, projectedVector.z);
}
// print(cam.transform.forward);
Ray ray = new Ray(controller.transform.position, controller.transform.forward);
RaycastHit hitInfo;
// Debug.DrawLine(ray.origin,new Vector3 (5,5,5));//划出射线,只有在scene视图中才能看到
lRend2.positionCount = 2;//设置顶点数
lRend2.SetPosition(0, controller.transform.position);//设置顶点位置
if (Physics.Raycast(ray, out hitInfo))
{
lRend2.SetPosition(1, hitInfo.point);//设置顶点位置
// obj_pointer.transform.position = hitInfo.point;
// Debug.DrawLine(ray.origin, hitInfo.point);//划出射线,只有在scene视图中才能看到
GameObject gameObj = hitInfo.collider.gameObject;
// Debug.Log("click object name is " + gameObj.name);
if (gameObj != null)//当射线碰撞目标为boot类型的物品 ,执行拾取操作
{
if (obj_grabble == null)
{
// if (m_currentTechnique == TECHINIQUE.ControllerOnly)
// else
// temp.transform.position = gameObj.transform.parent.gameObject.transform.position;
// temp.transform.rotation = gameObj.transform.parent.gameObject.transform.rotation;
m_currentOperatingModel = gameObj.transform.parent.gameObject;
temp.transform.SetParent(m_currentOperatingModel.transform);
temp.transform.localPosition = new Vector3(0, 0, 0);
temp.transform.localEulerAngles = new Vector3(0, 0, 0);
obj_grabble = temp;
objSelected = true;
}
// Debug.Log("pick up!");
}
else
{
objSelected = false;
}
}
else
{
lRend2.SetPosition(1, controller.transform.forward * 1000);//设置顶点位置
objSelected = false;
}
if (objSelected && OVRInput.Get(OVRInput.RawButton.RIndexTrigger))
{
m_controllerInputEnabled = true;
}
else
{
if (!OVRInput.Get(OVRInput.RawButton.RIndexTrigger))
{
m_controllerInputEnabled = false;
}
}
if (OVRInput.GetDown(OVRInput.RawButton.RHandTrigger))
{
Debug.LogWarning("GetDown");
if (obj_grabble != null)
{
obj_grabble.transform.SetParent(obj_grabble_parent.transform);
obj_grabble.transform.position = m_currentOperatingModel.transform.position;
obj_grabble.transform.rotation = m_currentOperatingModel.transform.rotation;
}
}
if (OVRInput.GetUp(OVRInput.RawButton.RHandTrigger))
{
Debug.LogWarning("GetUp");
if (obj_grabble != null)
{
obj_grabble.transform.SetParent(obj_grabble_parent.transform);
obj_grabble.transform.position = m_currentOperatingModel.transform.position;
obj_grabble.transform.rotation = m_currentOperatingModel.transform.rotation;
}
}
if (m_controllerInputEnabled)
{
if (obj_grabble != null)
{
// obj_asymetric_operation = obj_grabble;
if (OVRInput.Get(OVRInput.RawButton.RHandTrigger))
{
// temp.transform.position = m_currentOperatingModel.transform.position;
// temp.transform.rotation = m_currentOperatingModel.transform.rotation;
obj_grabble.transform.SetParent(controller.transform);
m_currentOperatingModel.transform.position = obj_grabble.transform.position;
}
else
{
obj_grabble.transform.SetParent(controller.transform);
m_currentOperatingModel.transform.rotation = obj_grabble.transform.rotation;
}
}
}
else
{
if (obj_grabble != null)
{
obj_grabble.transform.SetParent(obj_grabble_parent.transform);
obj_grabble = null;
// obj_asymetric_operation = null;
}
}
}
public void ProcessingData(DATA_NAME dataName, byte[] data)
{
switch (dataName)
{
case DATA_NAME.DT_SCENE1:
Data_ModelNumber sceneID = new Data_ModelNumber(data);
// m_currentScene = (CURRENT_SCENR)sceneID.value;
break;
case DATA_NAME.DT_ASYMETRIC_ROTATE:
Data_Position3f deltaPos = new Data_Position3f(data);
Debug.Log("DT_ASYMETRIC_ROTATE");
// if (m_phoneInputEnabled)
{
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.up, -deltaPos.value[0] / 10);
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.right, deltaPos.value[1] / 10);
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.forward, deltaPos.value[2] / 10);
}
break;
case DATA_NAME.DT_ASYMETRIC_TRANSLATE:
Data_Position3f deltaTrans = new Data_Position3f(data);
// if (m_phoneInputEnabled)
{
obj_grabble.transform.Translate(new Vector3(deltaTrans.value[0] / 1080 * 0.7f, deltaTrans.value[1] / 1080 * 0.7f, -deltaTrans.value[2] / 1080 * 0.7f), cam.transform);
// obj_asymetric_operation.transform.Translate(cam.transform.up * deltaTrans.value[1] / 1080 * 0.7f, cam.transform);
// obj_asymetric_operation.transform.Translate(cam.transform.right * deltaTrans.value[2] / 1080 * 0.7f, cam.transform);
}
break;
case DATA_NAME.DT_ASYMETRIC_SCALE:
Data_Position3f deltaScale = new Data_Position3f(data);
// if (m_phoneInputEnabled)
{
Debug.Log(deltaScale.value[0]);
Vector3 localScale = obj_grabble.transform.localScale;
Vector3 scale = new Vector3(localScale.x * (1 + deltaScale.value[0] / 1080),
localScale.y * (1 + deltaScale.value[0] / 1080),
localScale.z * (1 + deltaScale.value[0] / 1080));
//最小缩放到 0.3 倍
if (scale.x > 0.03f && scale.x < 10)
{
obj_grabble.transform.localScale = scale;
}
}
break;
default:
Debug.LogError("Unknown datatype");
break;
}
}
void ExitApp()
{
Debug.LogError("Error Exit!");
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
public string ConvertV3ToString(Vector3 data)
{
return data.x.ToString() + "," + data.y.ToString() + "," + data.z.ToString();
}
string GetCurrentTime()
{
int hour = DateTime.Now.Hour;
int minute = DateTime.Now.Minute;
int second = DateTime.Now.Second;
int year = DateTime.Now.Year;
int month = DateTime.Now.Month;
int day = DateTime.Now.Day;
return string.Format("{0:D4}:{1:D2}:{2:D2} {3:D2}:{4:D2}:{5:D2}", year, month, day, hour, minute, second);
}
}
单独控制位置
using ServerCommunication;
using System;
//using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class TestControllerTranslation : MonoBehaviour
{
public TCPIP_Base m_TCPIP_Base;
public GameObject obj_grabble;
public GameObject obj_grabble_parent;
RaycastHit hitInfo;
public GameObject controller;
LineRenderer lRend2;
public bool objSelected = false;
// GameObject obj_asymetric_operation;
//define the ralative space for object movement
//central eye: CenterEyeAnchor
public GameObject cam;
//OvrCamera
public GameObject obj_VRCamera;
public GameObject m_objRayStartPoint;
// CURRENT_SCENR m_currentScene = CURRENT_SCENR.BIMANUAL_OPERATION;
public GameObject obj_blueBackground;
public GameObject obj_virtualCamera;
// bool m_phoneInputEnabled = false;
bool m_controllerInputEnabled = false;
// public GameObject m_finishAlignedModel;
// bool m_objAlignedCkeck = false;
// public GameObject m_finishAlignedText;
bool m_last_controllerInput_status = false;
public GameObject temp;
public double fps = 0;
GameObject m_currentModelDetected;
// Start is called before the first frame update
void Start()
{
if (m_TCPIP_Base == null)
{
try
{
m_TCPIP_Base = GetComponent<TCPIP_Base>();
}
catch (System.Exception)
{
Debug.LogError("No baes tcpip class");
ExitApp();
return;
}
}
if (m_TCPIP_Base == null)
{
Debug.LogError("PLease set base tcpip class");
ExitApp();
return;
}
m_TCPIP_Base.OnProcessingData += ProcessingData;
lRend2 = controller.AddComponent<LineRenderer>();
lRend2.SetWidth(0.002f, 0.002f);
}
private void Update()
{
fps = 1.0 / Time.deltaTime;
Vector2 controllerStick = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
if (Mathf.Abs(controllerStick.x) > 0.01 || Mathf.Abs(controllerStick.y) > 0.01)
{
// obj_VRCamera.transform.Translate(controllerStick.x / 100, 0, controllerStick.y / 100, cam.transform);
Vector3 projectedVector = cam.transform.forward * controllerStick.y / 100 + cam.transform.right * controllerStick.x / 100;
obj_VRCamera.transform.Translate(projectedVector.x, 0, projectedVector.z);
}
// print(cam.transform.forward);
Ray ray = new Ray(controller.transform.position, controller.transform.forward);
RaycastHit hitInfo;
// Debug.DrawLine(ray.origin,new Vector3 (5,5,5));//划出射线,只有在scene视图中才能看到
lRend2.positionCount = 2;//设置顶点数
lRend2.SetPosition(0, controller.transform.position);//设置顶点位置
if (Physics.Raycast(ray, out hitInfo))
{
lRend2.SetPosition(1, hitInfo.point);//设置顶点位置
// obj_pointer.transform.position = hitInfo.point;
// Debug.DrawLine(ray.origin, hitInfo.point);//划出射线,只有在scene视图中才能看到
GameObject gameObj = hitInfo.collider.gameObject;
// Debug.Log("click object name is " + gameObj.name);
if (gameObj != null)//当射线碰撞目标为boot类型的物品 ,执行拾取操作
{
if (obj_grabble == null)
{
// if (m_currentTechnique == TECHINIQUE.ControllerOnly)
// else
// temp.transform.position = gameObj.transform.parent.gameObject.transform.position;
// temp.transform.rotation = gameObj.transform.parent.gameObject.transform.rotation;
m_currentModelDetected = gameObj.transform.parent.gameObject;
temp.transform.SetParent(m_currentModelDetected.transform);
temp.transform.localPosition = new Vector3(0, 0, 0);
temp.transform.localEulerAngles = new Vector3(0, 0, 0);
obj_grabble = temp;
objSelected = true;
}
// Debug.Log("pick up!");
}
else
{
objSelected = false;
}
}
else
{
lRend2.SetPosition(1, controller.transform.forward * 1000);//设置顶点位置
objSelected = false;
}
if (objSelected && OVRInput.Get(OVRInput.RawButton.RIndexTrigger))
{
m_controllerInputEnabled = true;
}
else
{
if (!OVRInput.Get(OVRInput.RawButton.RIndexTrigger))
{
m_controllerInputEnabled = false;
}
}
if (m_controllerInputEnabled)
{
if (obj_grabble != null)
{
// obj_asymetric_operation = obj_grabble;
if (OVRInput.Get(OVRInput.RawButton.RHandTrigger))
{
// temp.transform.position = m_currentOperatingModel.transform.position;
// temp.transform.rotation = m_currentOperatingModel.transform.rotation;
obj_grabble.transform.SetParent(controller.transform);
m_currentModelDetected.transform.position = obj_grabble.transform.position;
}
else
{
obj_grabble.transform.SetParent(obj_grabble_parent.transform);
obj_grabble.transform.position = m_currentModelDetected.transform.position;
obj_grabble.transform.rotation = m_currentModelDetected.transform.rotation;
}
}
}
else
{
if (obj_grabble != null)
{
obj_grabble.transform.SetParent(obj_grabble_parent.transform);
obj_grabble = null;
// obj_asymetric_operation = null;
}
}
}
public void ProcessingData(DATA_NAME dataName, byte[] data)
{
switch (dataName)
{
case DATA_NAME.DT_SCENE1:
Data_ModelNumber sceneID = new Data_ModelNumber(data);
// m_currentScene = (CURRENT_SCENR)sceneID.value;
break;
case DATA_NAME.DT_ASYMETRIC_ROTATE:
Data_Position3f deltaPos = new Data_Position3f(data);
Debug.Log("DT_ASYMETRIC_ROTATE");
// if (m_phoneInputEnabled)
{
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.up, -deltaPos.value[0] / 10);
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.right, deltaPos.value[1] / 10);
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.forward, deltaPos.value[2] / 10);
}
break;
case DATA_NAME.DT_ASYMETRIC_TRANSLATE:
Data_Position3f deltaTrans = new Data_Position3f(data);
// if (m_phoneInputEnabled)
{
obj_grabble.transform.Translate(new Vector3(deltaTrans.value[0] / 1080 * 0.7f, deltaTrans.value[1] / 1080 * 0.7f, -deltaTrans.value[2] / 1080 * 0.7f), cam.transform);
// obj_asymetric_operation.transform.Translate(cam.transform.up * deltaTrans.value[1] / 1080 * 0.7f, cam.transform);
// obj_asymetric_operation.transform.Translate(cam.transform.right * deltaTrans.value[2] / 1080 * 0.7f, cam.transform);
}
break;
case DATA_NAME.DT_ASYMETRIC_SCALE:
Data_Position3f deltaScale = new Data_Position3f(data);
// if (m_phoneInputEnabled)
{
Debug.Log(deltaScale.value[0]);
Vector3 localScale = obj_grabble.transform.localScale;
Vector3 scale = new Vector3(localScale.x * (1 + deltaScale.value[0] / 1080),
localScale.y * (1 + deltaScale.value[0] / 1080),
localScale.z * (1 + deltaScale.value[0] / 1080));
//最小缩放到 0.3 倍
if (scale.x > 0.03f && scale.x < 10)
{
obj_grabble.transform.localScale = scale;
}
}
break;
default:
Debug.LogError("Unknown datatype");
break;
}
}
void ExitApp()
{
Debug.LogError("Error Exit!");
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
public string ConvertV3ToString(Vector3 data)
{
return data.x.ToString() + "," + data.y.ToString() + "," + data.z.ToString();
}
string GetCurrentTime()
{
int hour = DateTime.Now.Hour;
int minute = DateTime.Now.Minute;
int second = DateTime.Now.Second;
int year = DateTime.Now.Year;
int month = DateTime.Now.Month;
int day = DateTime.Now.Day;
return string.Format("{0:D4}:{1:D2}:{2:D2} {3:D2}:{4:D2}:{5:D2}", year, month, day, hour, minute, second);
}
}
单独控制旋转
using ServerCommunication;
using System;
//using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class TestControllerTranslation : MonoBehaviour
{
public TCPIP_Base m_TCPIP_Base;
public GameObject obj_grabble;
public GameObject obj_grabble_parent;
RaycastHit hitInfo;
public GameObject controller;
LineRenderer lRend2;
public bool objSelected = false;
// GameObject obj_asymetric_operation;
//define the ralative space for object movement
//central eye: CenterEyeAnchor
public GameObject cam;
//OvrCamera
public GameObject obj_VRCamera;
public GameObject m_objRayStartPoint;
// CURRENT_SCENR m_currentScene = CURRENT_SCENR.BIMANUAL_OPERATION;
public GameObject obj_blueBackground;
public GameObject obj_virtualCamera;
// bool m_phoneInputEnabled = false;
bool m_controllerInputEnabled = false;
// public GameObject m_finishAlignedModel;
// bool m_objAlignedCkeck = false;
// public GameObject m_finishAlignedText;
bool m_last_controllerInput_status = false;
public GameObject temp;
public double fps = 0;
GameObject m_currentModelDetected;
// Start is called before the first frame update
void Start()
{
if (m_TCPIP_Base == null)
{
try
{
m_TCPIP_Base = GetComponent<TCPIP_Base>();
}
catch (System.Exception)
{
Debug.LogError("No baes tcpip class");
ExitApp();
return;
}
}
if (m_TCPIP_Base == null)
{
Debug.LogError("PLease set base tcpip class");
ExitApp();
return;
}
m_TCPIP_Base.OnProcessingData += ProcessingData;
lRend2 = controller.AddComponent<LineRenderer>();
lRend2.SetWidth(0.002f, 0.002f);
}
private void Update()
{
fps = 1.0 / Time.deltaTime;
Vector2 controllerStick = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
if (Mathf.Abs(controllerStick.x) > 0.01 || Mathf.Abs(controllerStick.y) > 0.01)
{
// obj_VRCamera.transform.Translate(controllerStick.x / 100, 0, controllerStick.y / 100, cam.transform);
Vector3 projectedVector = cam.transform.forward * controllerStick.y / 100 + cam.transform.right * controllerStick.x / 100;
obj_VRCamera.transform.Translate(projectedVector.x, 0, projectedVector.z);
}
// print(cam.transform.forward);
Ray ray = new Ray(controller.transform.position, controller.transform.forward);
RaycastHit hitInfo;
// Debug.DrawLine(ray.origin,new Vector3 (5,5,5));//划出射线,只有在scene视图中才能看到
lRend2.positionCount = 2;//设置顶点数
lRend2.SetPosition(0, controller.transform.position);//设置顶点位置
if (Physics.Raycast(ray, out hitInfo))
{
lRend2.SetPosition(1, hitInfo.point);//设置顶点位置
// obj_pointer.transform.position = hitInfo.point;
// Debug.DrawLine(ray.origin, hitInfo.point);//划出射线,只有在scene视图中才能看到
GameObject gameObj = hitInfo.collider.gameObject;
// Debug.Log("click object name is " + gameObj.name);
if (gameObj != null)//当射线碰撞目标为boot类型的物品 ,执行拾取操作
{
if (obj_grabble == null)
{
// if (m_currentTechnique == TECHINIQUE.ControllerOnly)
// else
// temp.transform.position = gameObj.transform.parent.gameObject.transform.position;
// temp.transform.rotation = gameObj.transform.parent.gameObject.transform.rotation;
m_currentModelDetected = gameObj.transform.parent.gameObject;
temp.transform.SetParent(m_currentModelDetected.transform);
temp.transform.localPosition = new Vector3(0, 0, 0);
temp.transform.localEulerAngles = new Vector3(0, 0, 0);
obj_grabble = temp;
objSelected = true;
}
// Debug.Log("pick up!");
}
else
{
objSelected = false;
}
}
else
{
lRend2.SetPosition(1, controller.transform.forward * 1000);//设置顶点位置
objSelected = false;
}
if (objSelected && OVRInput.Get(OVRInput.RawButton.RIndexTrigger))
{
m_controllerInputEnabled = true;
}
else
{
if (!OVRInput.Get(OVRInput.RawButton.RIndexTrigger))
{
m_controllerInputEnabled = false;
}
}
if (m_controllerInputEnabled)
{
if (obj_grabble != null)
{
// obj_asymetric_operation = obj_grabble;
if (OVRInput.Get(OVRInput.RawButton.RHandTrigger))
{
// temp.transform.position = m_currentOperatingModel.transform.position;
// temp.transform.rotation = m_currentOperatingModel.transform.rotation;
obj_grabble.transform.SetParent(controller.transform);
m_currentModelDetected.transform.rotation = obj_grabble.transform.rotation;
}
else
{
obj_grabble.transform.SetParent(obj_grabble_parent.transform);
obj_grabble.transform.position = m_currentModelDetected.transform.position;
obj_grabble.transform.rotation = m_currentModelDetected.transform.rotation;
}
}
}
else
{
if (obj_grabble != null)
{
obj_grabble.transform.SetParent(obj_grabble_parent.transform);
obj_grabble = null;
// obj_asymetric_operation = null;
}
}
}
public void ProcessingData(DATA_NAME dataName, byte[] data)
{
switch (dataName)
{
case DATA_NAME.DT_SCENE1:
Data_ModelNumber sceneID = new Data_ModelNumber(data);
// m_currentScene = (CURRENT_SCENR)sceneID.value;
break;
case DATA_NAME.DT_ASYMETRIC_ROTATE:
Data_Position3f deltaPos = new Data_Position3f(data);
Debug.Log("DT_ASYMETRIC_ROTATE");
// if (m_phoneInputEnabled)
{
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.up, -deltaPos.value[0] / 10);
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.right, deltaPos.value[1] / 10);
obj_grabble.transform.RotateAround(obj_grabble.transform.position, cam.transform.forward, deltaPos.value[2] / 10);
}
break;
case DATA_NAME.DT_ASYMETRIC_TRANSLATE:
Data_Position3f deltaTrans = new Data_Position3f(data);
// if (m_phoneInputEnabled)
{
obj_grabble.transform.Translate(new Vector3(deltaTrans.value[0] / 1080 * 0.7f, deltaTrans.value[1] / 1080 * 0.7f, -deltaTrans.value[2] / 1080 * 0.7f), cam.transform);
// obj_asymetric_operation.transform.Translate(cam.transform.up * deltaTrans.value[1] / 1080 * 0.7f, cam.transform);
// obj_asymetric_operation.transform.Translate(cam.transform.right * deltaTrans.value[2] / 1080 * 0.7f, cam.transform);
}
break;
case DATA_NAME.DT_ASYMETRIC_SCALE:
Data_Position3f deltaScale = new Data_Position3f(data);
// if (m_phoneInputEnabled)
{
Debug.Log(deltaScale.value[0]);
Vector3 localScale = obj_grabble.transform.localScale;
Vector3 scale = new Vector3(localScale.x * (1 + deltaScale.value[0] / 1080),
localScale.y * (1 + deltaScale.value[0] / 1080),
localScale.z * (1 + deltaScale.value[0] / 1080));
//最小缩放到 0.3 倍
if (scale.x > 0.03f && scale.x < 10)
{
obj_grabble.transform.localScale = scale;
}
}
break;
default:
Debug.LogError("Unknown datatype");
break;
}
}
void ExitApp()
{
Debug.LogError("Error Exit!");
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
public string ConvertV3ToString(Vector3 data)
{
return data.x.ToString() + "," + data.y.ToString() + "," + data.z.ToString();
}
string GetCurrentTime()
{
int hour = DateTime.Now.Hour;
int minute = DateTime.Now.Minute;
int second = DateTime.Now.Second;
int year = DateTime.Now.Year;
int month = DateTime.Now.Month;
int day = DateTime.Now.Day;
return string.Format("{0:D4}:{1:D2}:{2:D2} {3:D2}:{4:D2}:{5:D2}", year, month, day, hour, minute, second);
}
}