Question by
Gann4Life · Jun 12, 2016 at 07:33 PM ·
c#variablesaddcomponentontriggerstayfixedjoint
¿How can i add a fixed joint configured by script?
Hello, im trying to make a grab script like gang beasts but with a fixed joint... The part that will create the fixed joint is trigger, i dont know if that im mading will works. Then i dont know really how works the "Add Component" in a script. Here is my incomplete script in C#:
using UnityEngine;
using System.Collections;
public class HandGrab : MonoBehaviour {
public KeyCode Grab;
public Transform RigidBody;
void OnTriggerStay () {
if(Input.GetKeyDown(Grab)){
/*Add fixed joint
fixed joint with this gameobject and any other rigidbody
getkeyup to delete or setactive the fixed joint*/
}
if(Input.GetKeyUp(Grab)){
/*Delete fixed joint or setactive fixed joint*/
}
}
}
So im browsing what i need to create and delete the fixed joint. Thanks for reading.
Comment