trying to make some spheres I’m throwing disappear after a few seconds. i know i have some syntax wrong and i tried looking through reference but I’m not understanding whats wrong. heres my code:
var speed = 3.0;
var boxy:Transform;
/////
var player : GameObject;
player = gameObject.tag =("player");
///////////
var balls : GameObject;
balls = gameObject.tag =("balls");
/////////
var floor: GameObject;
floor = gameObject.tag =("floor");
/////////////////
function Update() {
if(Input.GetButtonDown("Fire1"))
{
var crate = Instantiate (boxy, transform.position, Quaternion.identity);
crate.rigidbody.AddForce(transform.forward * 1000);
}}
function OnCollisionEnter (hit : Collision)
{ ///you are colliding
Debug.Log("CollidingWithAnything");
if(hit.gameObject.floor == hit.gameObject.balls){ //now colliding with certain object
Debug.Log("Colliding With Certain");
Destroy (balls, 2);
}
}
You know, you can format this code by selecting it, then hit the 010/101 button above the text area. Please do.
– DaveA