Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Rotate GameObject on Touch along Y axis

$
0
0
I have a script which i found somewhere online. The below script works fine for rotation of game object along x axis ( horizontally ) but i am not able to get it working vertically ( along y axis ). Code : #pragma strict private var h : float; private var v : float; private var horozontalSpeed : float = 1.0; private var verticalSpeed : float = 1.0; function Update() { if (Input.touchCount == 1) { var touch : Touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Moved) { var v : float = verticalSpeed * touch.deltaPosition.x ; transform.Rotate ( h, 0, 0); var h : float = horozontalSpeed * touch.deltaPosition.y ; transform.Rotate (0, -v, 0); } } } Any help appreciated !

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>