- Home /
Duplicate Question
I need help converting this script to touchscreen
I am trying to develop a JavaScript that will allow me to rotate the character in z axis by swiping left and right android
// 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);; }
You haven't asked a question. What do you mean by "converting this script to tou"?
Javascript is a language, there is only one of them! You can't say "A Javascript", only "The Javascript"
Unity's Javascript is called UnityScript.
WTF is "tou"?
There are a TON of tutorials out there for converting scripts!
As @Broxxar said... where is the question?
@Benproductions1 can you unlock this post as it has properly formatted code and close the other one?
also? @Developerx what's wrong with this Question that you had to create 3. Question like this SA$$anonymous$$E!!!?
None the less there are many posts concerned with making scripts that work on mobile and "converting" between the different input variations. It also seems (purely because of the lack of care the OP has given either of his questions) that he is just asking for others to do it for him.
Although the other question doesn't have formatted code, it does have a comment that answers the question, so I'll be leaving this one closed for now and the other one open :)
Follow this Question
Related Questions
I need help making this script work for android touchscreen 0 Answers
How to use correctly IsPointerOverGameObject with two differen gameObjects ? 1 Answer
How to get position of touch on touch screen 1 Answer
rotation to axis conversion problem? 1 Answer
Input.gyro.attitude not working on newer Android devices 3 Answers