Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Obiparticleattachment
#6
(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:

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();
        }
    }
}
Thank you so much will try it today.
Reply


Messages In This Thread
Obiparticleattachment - by mayaeraky - 02-06-2021, 07:26 PM
RE: Obiparticleattachment - by josemendez - 03-06-2021, 09:13 AM
RE: Obiparticleattachment - by mayaeraky - 03-06-2021, 10:22 PM
RE: Obiparticleattachment - by mayaeraky - 07-06-2021, 10:38 AM
RE: Obiparticleattachment - by josemendez - 07-06-2021, 10:45 AM
RE: Obiparticleattachment - by mayaeraky - 07-06-2021, 10:54 AM