Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

I need help with this script. Can't figure out my it isn't working.,Can't get this script to work

$
0
0
I am simply trying to make a cube go from one place to another and then be destroyed. I am new to JavaScript. Thank you for your help. Here is the script: function Start () { } function Update () { Square (); } function Square () { var ZAxisStop : boolean = true; while (ZAxisStop) { gameObject.transform.Translate(0, 0, Time.deltaTime * -2.5); if(gameObject.GetComponent(Transform).position == Vector3(229, 0.5, 227)) Destroy (gameObject); break; } } Thank you :),I am trying to make a cube simply go from one place to another and be destroyed using JavaScript. When I run it, it is never destroyed, it just keeps going. Please help me. This is my script: function Start () { } function Update () { Square (); } function Square () { var ZAxisStop : boolean = true; while (ZAxisStop) { gameObject.transform.Translate(0, 0, Time.deltaTime * -2.5); if(gameObject.GetComponent(Transform).position == Vector3(229, 0.5, 227)) Destroy (gameObject); break; } } Thank you:)

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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