Skip to content

Instantly share code, notes, and snippets.

@WakkyFree

WakkyFree/DeleteBall.cs

Last active Dec 21, 2016
Embed
What would you like to do?
Unity script to delete a ball
using UnityEngine;
using System.Collections;
public class DeleteBall : MonoBehaviour {
private Rigidbody rig;
// Use this for initialization
void Start () {
rig = this.GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter(Collision collision) {
if (collision.gameObject.tag != "Ground" & collision.gameObject.tag != "Bat") {
//Destroy(gameObject);
rig.velocity = Vector3.zero;
rig.angularVelocity = Vector3.zero;
transform.position = new Vector3(0, 0, -5.8f);
ShootBall.shootSwitch = true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment