Quantcast
Channel: Questions in topic: "crash"
Viewing all articles
Browse latest Browse all 2383

How do I get position from an object ?

$
0
0
Here is my code : public int Limit; public static float Speed = 10, X; private Rigidbody rb; void Start () { rb = GetComponent(); Speed = Random.Range (5, 10); Limit = Random.Range (100, 1000); } void Update () { Vector3 pos = transform.position; Debug.Log (transform.position.y); } void FixedUpdate () { while (transform.position.y < Limit) { rb.AddForce (0.5f, (Random.Range (100, 900)), 0 * Speed); } The problem is that unity crash, I think it's the "while" which can't stop, beacause it cannot acess to the transform.position . I would like to get the position x from my object to stop the AddForce when the limit is overtake. I need help please Thank's

Viewing all articles
Browse latest Browse all 2383

Trending Articles



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