Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

I need help making this script work for android touchscreen

$
0
0
I am trying to develop a JavaScript that will allow me to rotate the character in z axis by swiping left and right on my android device. Here is what I have But it only works on pc. // Smoothly tilts a transform towards a target rotation. var smooth = 2.0; var tiltAngle = 30.0; function Update () { var tiltAroundZ = Input.GetAxis("Horizontal") * tiltAngle; var tiltAroundX = Input.GetAxis("Vertical") * tiltAngle; var target = Quaternion.Euler (tiltAroundX, 0, tiltAroundZ); // Dampen towards the target rotation transform.rotation = Quaternion.Slerp(transform.rotation, target,Time.deltaTime * smooth);; } Thanks

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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