Roll A Ball Beginner Tutorial in Android controls
Thanks for the great tutorial for beginner. I have successfully built the game and understood the theory behind the scripting.
I was just wondering, can we build the game for Android instead of the PC? and if we do so, how are we going to control the ball in a touch screen.
current PC setting use the directional arrows but in touch screen there are no arrow buttons
any reply will be greatly appreciated
Thank You
Answer by LovelyVibes · Mar 05, 2017 at 05:56 AM
Try implementing this into your code, ^~^
moveHorizontal = Input.acceleration.x;
moveVertical = Input.acceleration.y;
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed * 2);
Not a problem my friend. ^~^ Just glad I could help out.
@LovelyVibes Should that replace the code for arrow keys? Because you can't combine it with the arrow keys script, since that will define movement twice?
Your answer
Follow this Question
Related Questions
Assets Folder Appearing to be Empty 2 Answers
Which Unity Tutorials should I watch? 0 Answers
Unity-Chan animation hands 0 Answers
We Are Free To Use Assets on Toturials or not ? 2 Answers
I am having trouble building the project for android 0 Answers