This commit is contained in:
ntr committed 2023-07-16 21:51:40 +10:00
1 parent 60f88367bc
commit bbcb434cd0
11 files changed
+62936 -115

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
using UnityEngine;
public class ShipPhysics : MonoBehaviour {
ShipControls ship;
float maxDmg = 150f;
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);
// }
if (collision.relativeVelocity.magnitude > maxDmg) {
Debug.Log("Ddddestroyed by" + collision.gameObject.name);
ship.Respawn();
return;
}
if (collision.gameObject.tag == "TrackLimits") {
Debug.Log("Track Limits " + collision.gameObject.name);
ship.Respawn();
return;
}
}
}