Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Problem with Ball Controll on Android

Discussion in 'Physics' started by Dawid_Matuszewski, May 2, 2019.

  1. Dawid_Matuszewski


    Mar 2, 2016
    Hi, I have a problem with my mobile game in which I'm controlling a ball using accelerometer. I'm using "AddForce" on a Rigidbody, but the ball isn't responsive enough. So if I want to stop my ball quickly, the delay is too long. Same solution on PC (using GetAxisRow-Horizontal/Vertical) is working quite well. I tried to use Rigidbody.velocity and I managed to eliminate the delay, but then the rest of game phisics isn't behaving correctly.
    Is there a mobile counterpart for "GetAxisRaw"?
    I'm using Unity 2018.3.12f1.
    I will appreciate any help, thank you :)

    Attached Files:

    Last edited: May 2, 2019
  2. srivello


    Jan 16, 2011
    Good question.

    If you look at this demo project

    You'll see that it uses input multiplied by a constant (e.g. a speed float with value of 5) for the AddForce()

    The higher speed makes your controls more responsive.

    If you want the object to 'slow down' more quickly you can increase its RigidBody.mass. Or you can apply a PhyisicsMaterial with friction to the moving object or the floor object.

    Try that!