RigidbodyEnable.cs 466 B

12345678910111213141516171819202122232425
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace VoxelImporter
  5. {
  6. public class RigidbodyEnable : MonoBehaviour
  7. {
  8. protected Rigidbody rb;
  9. void Awake()
  10. {
  11. rb = GetComponent<Rigidbody>();
  12. if (rb == null)
  13. {
  14. Destroy(this);
  15. }
  16. }
  17. void OnCollisionEnter()
  18. {
  19. rb.isKinematic = false;
  20. }
  21. }
  22. }