Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Accelerometer too sensitive

Discussion in '2D' started by jy_erwewrwrew, Mar 17, 2021.

  1. jy_erwewrwrew

    jy_erwewrwrew

    Joined:
    Apr 21, 2020
    Posts:
    7
    So apparently the accelerometer is too sensitive by just tilting a bit and the ball just move like crazy/fast. So i do i slow down or decrease the sensitivity?

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class acce : MonoBehaviour
    5. {
    6.     private Rigidbody2D rigid;
    7.     private Vector2 movement;
    8.     public float movementSpeed = 10f;
    9.  
    10.     void Start()
    11.     {
    12.         rigid = GetComponent<Rigidbody2D>();
    13.     }
    14.  
    15.     void Update()
    16.     {
    17.         movement = new Vector2(Input.acceleration.x,0) * movementSpeed;
    18.         rigid.AddForce(movement);
    19.     }
    20. }
     
  2. jy_erwewrwrew

    jy_erwewrwrew

    Joined:
    Apr 21, 2020
    Posts:
    7
    *how do I