cancel
Showing results for 
Search instead for 
Did you mean: 

(SOLVED) Objects Grabbed Lose Parent When Using Artificial Turning (Video Included)

KevinLongtime
Heroic Explorer
SOLVED! FIX HAS BEEN UPDATED IN OP OF THIS THREAD: https://forums.oculus.com/community/discussion/47204/avatar-grab-sample-available-unity


Issue Occurs at 0:18

https://www.youtube.com/watch?v=j0teT5IL3E8

6072tiy466fm.jpg

Anything I'm overlooking? Tried parenting the avatar system to a bunch of different things and it doesn't solve this yet. Not only does it mess up an object you current have held but it messed up the detection for picking up other objects in the scene unless you resent orientation.
5 REPLIES 5

KevinLongtime
Heroic Explorer
Great news, thank you so much @imperativity for responding and looking into it! Been dying to setup a little scene you can walk around in artificially and still use your hands.

Happy Holidays!

KevinLongtime
Heroic Explorer
First of all thank you for taking the time to help!

I wish I was more fluent in coding because I'm having a hard time figuring out where you want me to put those new values. Tried a bunch of different combos of where I think it might be and got tons of compiler errors until I tried this which didn't have an error but acted strangely

The original grabber.cs looks like this:

        {
            Vector3 handPos = OVRInput.GetLocalControllerPosition(m_controller);
            Quaternion handRot = OVRInput.GetLocalControllerRotation(m_controller);
            GetComponent<Rigidbody>().MovePosition(m_anchorOffsetPosition + handPos + m_parentTransform.position);
            GetComponent<Rigidbody>().MoveRotation(handRot * m_anchorOffsetRotation * m_parentTransform.rotation);

            if (!m_useFixedJointForGrabbedObject && !m_parentHeldObject)
            {
                MoveGrabbedObject();
            }
            m_lastPos = transform.position;
            m_lastRot = transform.rotation;
        }

What I gathered from your post was to try this:

        {
            Vector3 handPos = OVRInput.GetLocalControllerPosition(m_controller);
            Quaternion handRot = OVRInput.GetLocalControllerRotation(m_controller);
            GetComponent<Rigidbody>().MovePosition(m_anchorOffsetPosition + handPos + m_parentTransform.position);
            GetComponent<Rigidbody>().MoveRotation(handRot * m_anchorOffsetRotation * m_parentTransform.rotation);

            if (!m_useFixedJointForGrabbedObject && !m_parentHeldObject)
            {
                MoveGrabbedObject();
            }
Vector3 destPos = m_parentTransform.TransformPoint(m_anchorOffsetPosition + handPos);
Quaternion destRot = handRot * m_anchorOffsetRotation * m_parentTransform.rotation;
        }


Got some really strange results. When an object is grabbed they start spazzing out and flying sporadically in strange circles. Wish I wasn't so new at coding.

pjenness
Rising Star

mfmf
Oculus Staff
I updated the sample to fix the issue. (In the original post.)

KevinLongtime
Heroic Explorer

mfmf said:

I updated the sample to fix the issue. (In the original post.)


@mfmf Works perfectly! Thank you!