Quantcast
Channel: Questions in topic: "up"
Viewing all articles
Browse latest Browse all 104

hi guys i have a problem with my player(Roll A Ball Game) on android, my player easily move left, right, up, down But when i tilt my phone to move player up it's too slow

$
0
0
using UnityEngine; using System.Collections; [RequireComponent(typeof(Rigidbody))] public class ForceFromAccelerometer : MonoBehaviour { // gravity constant public float g=9.8f; void FixedUpdate() { // normalize axis var gravity = new Vector3 ( Input.acceleration.x, Input.acceleration.z, Input.acceleration.y ) * g; GetComponent().AddForce (gravity, ForceMode.Acceleration); } }

Viewing all articles
Browse latest Browse all 104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>