|
Hello, I´m rotating an object in iOS (on touch) through the following code: function Update () { if (Input.touchCount == 1) { var touch : Touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Moved) { h = horizontalSpeed * touch.deltaPosition.x; transform.Rotate(0, -h, 0, Space.World); v = verticalSpeed * touch.deltaPosition.y; transform.Rotate(v, 0, 0, Space.World); } } } How do I change this so that the underside of the object is never shown?
(comments are locked)
|
|
you need to define bounds for the value somthing like h = horizontalSpeed * touch.deltaPosition.x; if(h>0 && themodel.transform.eulerangels.y <90) { transform.Rotate(0, -h, 0, Space.World); } you only need to do this for the y value Thanks I tried this but then I couldn't rotate horizontally, only vertically which meant that bottom side can be seen. I tried changing it to if(v>0 && transform.eulerAngles.x <90) { transform.Rotate(v, 0, 0, Space.World); but this doesn't work either. I can still see the bottom side of the object when I rotate.
Aug 14 '12 at 04:15 AM
cekk
change the angles to match you limits. dose it limit the rotating?
Aug 15 '12 at 09:03 AM
sfc.itzhak
(comments are locked)
|
