Skip to content

Instantly share code, notes, and snippets.

@WakkyFree
Last active December 21, 2016 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WakkyFree/be41a8d14b898377990249bfd3615047 to your computer and use it in GitHub Desktop.
Save WakkyFree/be41a8d14b898377990249bfd3615047 to your computer and use it in GitHub Desktop.
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