- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
77 lines
2.0 KiB
Plaintext
77 lines
2.0 KiB
Plaintext
namespace VRTK
|
|
{
|
|
using UnityEngine;
|
|
using System.Collections.Generic;
|
|
|
|
public class SDK_ControllerSim : MonoBehaviour
|
|
{
|
|
private Vector3 lastPos;
|
|
private Quaternion lastRot;
|
|
private List<Vector3> posList;
|
|
private List<Vector3> rotList;
|
|
private bool selected;
|
|
private float magnitude;
|
|
private Vector3 axis;
|
|
|
|
public bool Selected
|
|
{
|
|
get
|
|
{
|
|
return selected;
|
|
}
|
|
set
|
|
{
|
|
selected = value;
|
|
}
|
|
}
|
|
|
|
public Vector3 GetVelocity()
|
|
{
|
|
Vector3 velocity = Vector3.zero;
|
|
foreach (Vector3 vel in posList)
|
|
{
|
|
velocity += vel;
|
|
}
|
|
velocity /= posList.Count;
|
|
return velocity;
|
|
}
|
|
|
|
public Vector3 GetAngularVelocity()
|
|
{
|
|
Vector3 angularVelocity = Vector3.zero;
|
|
foreach (Vector3 vel in rotList)
|
|
{
|
|
angularVelocity += vel;
|
|
}
|
|
angularVelocity /= rotList.Count;
|
|
return angularVelocity;
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
posList = new List<Vector3>();
|
|
rotList = new List<Vector3>();
|
|
lastPos = transform.position;
|
|
lastRot = transform.rotation;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
posList.Add((transform.position - lastPos) / Time.deltaTime);
|
|
if (posList.Count > 4)
|
|
{
|
|
posList.RemoveAt(0);
|
|
}
|
|
Quaternion deltaRotation = transform.rotation * Quaternion.Inverse (lastRot);
|
|
deltaRotation.ToAngleAxis(out magnitude, out axis);
|
|
rotList.Add((axis * magnitude));
|
|
if (rotList.Count > 4)
|
|
{
|
|
rotList.RemoveAt(0);
|
|
}
|
|
lastPos = transform.position;
|
|
lastRot = transform.rotation;
|
|
}
|
|
}
|
|
}
|