UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"Object fall down with mobile shake to left and right"
public class AccelerationControlScript : MonoBehaviour { public GameObject object1, object2, object3, object4; Vector3 accelerationDir; void Update () { accelerationDir = Input.acceleration; if (accelerationDir.sqrMagnitude >= 5f) { object1.gameObject.GetComponent<Rigidbody2D> ().isKinematic = false; object2.gameObject.GetComponent<Rigidbody2D> ().isKinematic = false; object3.gameObject.GetComponent<Rigidbody2D> ().isKinematic = false; object4.gameObject.GetComponent<Rigidbody2D> ().isKinematic = false; } } }