I need some help accessing a game objects spring joint using C#. I just can’t seem to figure it out. What I would really like to do is remove/disable the joint on collision.
Hi ,
some quick pseudo code :
using UnityEngine;
using System.Collections;
public class destroySpring : MonoBehaviour {
public GameObject myGameObject;
private SpringJoint sp;
void OnCollisioneEnter(Collision col)
{
if (myGameObject)
sp = myGameObject.GetComponent(typeof(SpringJoint)) as SpringJoint ;
else Debug.Log("GameObject missing!");
if (sp) Destroy(sp);
}
}
I dont know how to disable it , though.
–
oxl