我試圖使拖動對象成爲可能。這個對象只能旋轉這麼多。 (Similair到門)。統一在最小和最大距離之間旋轉
這裏是代碼高級編輯,旋轉工作的對象。 我有2個向量maxrotation和minrotation。
只要用戶拖動可交互對象,就會調用此代碼。 (像更新,但只有拖動時)
if (GestureManager.Instance.IsNavigating &&
HandsManager.Instance.FocusedGameObject == gameObject)
{
//speed and navigiation of rotation
float rotationFactor;
rotationFactor = ManipulationManager.Instance.ManipulationPosition.y * RotationSensitivity;
totransform.Rotate(new Vector3(rotationFactor, 0, 0));
}
這將是偉大的,如果我可以在這裏使用if語句。我嘗試了很多東西,但仍然無法使用。
如上所述代碼粘貼在這裏工作。該對象應該是可拖動的,但只能達到某個點。
totransform是變換將旋轉
任何想法將是巨大的和最欣賞的。
親切的問候。
嗯,你做了什麼?你可以在totransform.Rotate之前做一個'Debug.Log(rotationFactor);'在你想要的最大和最小位置上覆制值,然後做一個if(withinThatRange){Rotate}'。應該管用!或者說,首先檢查旋轉。 – Maakep
btw「totransform」不是一個錯字,對吧? – Maakep
啊對不起,我沒有詳細說明我會改變它。 totransform是將被轉換的對象的轉換。 –