public void AddAxis(RotateOnAxis roa) { if (!RotatatableAxis.Contains(roa)) { RotatatableAxis.Add(roa); } }
private void determineAxisToRotate(Vector3 direction) { //Debug.Log("xRP: " + RotatePlane1 + " yRP: " + RotatePlane2); RotateOnAxis xRoa = RotatableAxis.Find(x => x.AxisPlane().x > 0.1); RotateOnAxis yRoa = RotatableAxis.Find(y => y.AxisPlane().y > 0.1); /* * Debug.Log(xRoa); * Debug.Log(yRoa); */ float xMag = Mathf.Abs(direction.x); float yMag = Mathf.Abs(direction.y); if (xMag > dragThreshold && xMag > yMag) { Debug.Log("Hor"); float xDir = Mathf.Sign(direction.x); Vector3 RotateDir = new Vector3(xDir * 90, 0); if (xRoa.rubik.canRotateAxis) { xRoa.RotateAxis(xDir * 90); } } else if (yMag > dragThreshold && yMag > xMag) { Debug.Log("Ver"); float yDir = Mathf.Sign(direction.y); Vector3 RotateDir = new Vector3(0, yDir * 90); if (yRoa.rubik.canRotateAxis) { yRoa.RotateAxis(yDir * 90); } } else { //Do nothing message } Debug.Log(direction); }