Last active
December 21, 2016 14:25
-
-
Save WakkyFree/be41a8d14b898377990249bfd3615047 to your computer and use it in GitHub Desktop.
Unity script to delete a ball
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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