Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3.  
  4. public class CactusPart : MonoBehaviour {
  5. private List<ContactPoint> _contacts = new List<ContactPoint>();
  6.  
  7. private void OnCollisionEnter(Collision collision) {
  8. foreach(var contact in collision.contacts) {
  9. Debug.DrawRay(contact.point, contact.normal, Color.red);
  10. _contacts.Add(contact);
  11. }
  12. Debug.Break();
  13. }
  14. void OnDrawGizmos() {
  15. if (_contacts.Count > 0) {
  16. foreach(var contactPoint in _contacts) {
  17. Gizmos.color = Color.red;
  18. Gizmos.DrawSphere(contactPoint.point, 0.1f);
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement