Moving a ball left/right with buttons
Hi.
I've just started learning C# over the last couple of weeks and have hit a brick wall for the last week trying to figure out what seems should be some simple code. Thanks in advance for any help.
Concept: 3D Ball in an endless runner. Camera follows behind ball. Currently runs fine on computer with a constant force forward and controls A/D for pulling to the left and right.
Issue: I want it to work on mobile with touch controls. I’ve set up 2 buttons, one on left of canvas/screen and one on the right. I want it so when the left button is press the ball moves left as if I were to press A and vice verse for right.
Is there not a code as simple as “if Left Button is pressed add force to left” and so on for right.
I've spent days on this code now and can not find the answer online, at least not one thats worked.
Your answer
Follow this Question
Related Questions
Problem with Swipe and rb.MovePosition 0 Answers
Swipe camera rotation controller (HELP) 0 Answers
Problems with mobile touch movements. 0 Answers
How to stop getTouch.position from going through UI buttons? 0 Answers
How can I make mobile UI buttons fire when first touched rather than released? 0 Answers