Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class WeldTogether : MonoBehaviour
  6. {
  7.     public ParticleSystem part;
  8.     int abra = 0;
  9.     public GameObject obj;
  10.     public List<ParticleCollisionEvent> collisionEvents;
  11.    
  12.     // Start is called before the first frame update
  13.     void Start()
  14.     {
  15.      
  16.    
  17.     }
  18.  
  19.     private void Update()
  20.     {
  21.         //Debug.Log(abra.ToString());
  22.        
  23.     }
  24.  
  25.    
  26.    
  27.     private void OnParticleCollision(GameObject other)
  28.     {
  29.         Debug.Log("kek");
  30.         abra = 1;
  31.     }
  32.  
  33.    
  34.     private void OnCollisionEnter(Collision other)
  35.         {
  36.         if (other.gameObject.GetComponent<Rigidbody>() != null)
  37.             Debug.Log("lol");
  38.            
  39.             {
  40.             if (abra == 1)
  41.             {
  42.                 FixedJoint tmp = obj.AddComponent<FixedJoint>();
  43.                 tmp.connectedBody = other.rigidbody;
  44.             }
  45.                
  46.             }
  47.  
  48.         }
  49.  
  50.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement