- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
|
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
[RequireComponent(typeof(SteamVR_TrackedObject))]
|
|
public class SteamVR_TestThrow : MonoBehaviour
|
|
{
|
|
public GameObject prefab;
|
|
public Rigidbody attachPoint;
|
|
|
|
SteamVR_TrackedObject trackedObj;
|
|
FixedJoint joint;
|
|
|
|
void Awake()
|
|
{
|
|
trackedObj = GetComponent<SteamVR_TrackedObject>();
|
|
}
|
|
|
|
void FixedUpdate()
|
|
{
|
|
var device = SteamVR_Controller.Input((int)trackedObj.index);
|
|
if (joint == null && device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger))
|
|
{
|
|
var go = GameObject.Instantiate(prefab);
|
|
go.transform.position = attachPoint.transform.position;
|
|
|
|
joint = go.AddComponent<FixedJoint>();
|
|
joint.connectedBody = attachPoint;
|
|
}
|
|
else if (joint != null && device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger))
|
|
{
|
|
var go = joint.gameObject;
|
|
var rigidbody = go.GetComponent<Rigidbody>();
|
|
Object.DestroyImmediate(joint);
|
|
joint = null;
|
|
Object.Destroy(go, 15.0f);
|
|
|
|
// We should probably apply the offset between trackedObj.transform.position
|
|
// and device.transform.pos to insert into the physics sim at the correct
|
|
// location, however, we would then want to predict ahead the visual representation
|
|
// by the same amount we are predicting our render poses.
|
|
|
|
var origin = trackedObj.origin ? trackedObj.origin : trackedObj.transform.parent;
|
|
if (origin != null)
|
|
{
|
|
rigidbody.velocity = origin.TransformVector(device.velocity);
|
|
rigidbody.angularVelocity = origin.TransformVector(device.angularVelocity);
|
|
}
|
|
else
|
|
{
|
|
rigidbody.velocity = device.velocity;
|
|
rigidbody.angularVelocity = device.angularVelocity;
|
|
}
|
|
|
|
rigidbody.maxAngularVelocity = rigidbody.angularVelocity.magnitude;
|
|
}
|
|
}
|
|
}
|