07-06-2021, 10:54 AM
(07-06-2021, 10:45 AM)josemendez Wrote: A slight variation of your code works fine for me. I simply replaced the SteamVr stuff with Input.GetKey(). Just make sure the collider in the hand is in contact with a particle:Thank you so much will try it today.
Code://[RequireComponent(typeof(ObiSolver))]
public class handgrabbing : MonoBehaviour
{
public SteamVR_Input_Sources source = SteamVR_Input_Sources.LeftHand;
bool handclosed;
ObiSolver held;
ObiContactGrabber contact;
// Start is called before the first frame update
void Start()
{
// held = GetComponent<Obi.ObiSolver>();
contact = GetComponent<ObiContactGrabber>();
}
// Update is called once per frame
void FixedUpdate()
{
var world = ObiColliderWorld.GetInstance();
if (Input.GetKey(KeyCode.Space)) {
handclosed = true;
Debug.Log("handclosed");
} else {
handclosed = false;
Debug.Log("NOT handclosed");
}
if (!handclosed) {
contact.Release();
} else {
contact.Grab();
}
}
}