Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using Cysharp.Threading.Tasks.Triggers;
- using UnityEngine;
- using TMPro;
- public class breakscript : MonoBehaviour
- {
- public GameObject broken;
- public TMP_Text magnitudeTextBox;
- // Start is called before the first frame update
- void Start()
- {
- }
- void OnCollisionEnter(Collision collision)
- {
- magnitudeTextBox.text = collision.relativeVelocity.sqrMagnitude.ToString();
- }
- // Update is called once per frame
- void Update()
- {
- }
- public void BreakThing()
- {
- Instantiate(broken, transform.position, transform.rotation);
- Destroy(gameObject);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement