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

I think that everything is all right...why it doesnt work correctly?

$
0
0
// The speed the bullet moves var Speed : float = 0.4; // The number of seconds before the bullet is automatically destroyed var SecondsUntilDestroy : float = 10; private var startTime : float; function Start () { startTime = Time.time; } function FixedUpdate () { // Move forward this.gameObject.transform.position += Speed * this.gameObject.transform.forward; // If the Bullet has existed as long as SecondsUntilDestroy, destroy it if (Time.time - startTime >= SecondsUntilDestroy) { Destroy(this.gameObject); } } function OnCollisionEnter(tc : Collision) { // Remove the Bullet from the world Destroy(this.gameObject); }

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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