23 lines
633 B
C#
23 lines
633 B
C#
using UnityEngine;
|
|
|
|
public class TrackLimits : MonoBehaviour {
|
|
ShipControls ship;
|
|
|
|
void Awake() {
|
|
ship = GetComponent<ShipControls>();
|
|
}
|
|
|
|
void OnCollisionEnter(Collision collision) {
|
|
// Debug-draw all contact points and normals
|
|
foreach (ContactPoint contact in collision.contacts) {
|
|
Debug.DrawRay(contact.point, contact.normal, Color.white);
|
|
}
|
|
|
|
Debug.Log("Collision mag " + collision.relativeVelocity.magnitude);
|
|
|
|
if (collision.gameObject.tag == "TrackLimits") {
|
|
Debug.Log(collision.gameObject.name);
|
|
ship.Respawn();
|
|
}
|
|
}
|
|
} |