Exemplo n.º 1
0
 void Start()
 {
     activeGrabObject = null;
     gameObject.AddComponent <Rigidbody>();
     gameObject.GetComponent <Rigidbody>().isKinematic = true;
     gameObject.GetComponent <Rigidbody>().useGravity  = false;
 }
Exemplo n.º 2
0
 public void release(custom_TrackedObject controller)
 {
     activeGrabObject = null;
     activeMove       = false;
     gameObject.GetComponent <Rigidbody>().isKinematic = false;
     gameObject.GetComponent <Rigidbody>().useGravity  = true;
     //gameObject.GetComponent<Rigidbody>().AddForce(gameObject.GetComponent<VelocityEstimator>().GetVelocityEstimate());
 }
Exemplo n.º 3
0
    public void grab(custom_TrackedObject controller)
    {
        activeGrabObject = controller;

        if (activeGrabObject == null)
        {
            activeMove = false;
        }
        else
        {
            initialRotation = Quaternion.Inverse(activeGrabObject.currRotation) * gameObject.transform.rotation;
            Vector3 tmpVec = gameObject.transform.position - activeGrabObject.currPosition;

            inititalOffset.Set(
                Vector3.Dot(activeGrabObject.currUpVec, tmpVec),
                Vector3.Dot(activeGrabObject.currRightVec, tmpVec),
                Vector3.Dot(activeGrabObject.currForwardVec, tmpVec)
                );
            activeMove = true;
            gameObject.GetComponent <Rigidbody>().isKinematic = true;
            gameObject.GetComponent <Rigidbody>().useGravity  = false;
        }
    }