(SOLVED) Objects Grabbed Lose Parent When Using Artificial Turning (Video Included) — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

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

KevinLongtimeKevinLongtime Posts: 283
Nexus 6
edited January 2017 in Unity Development
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





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.

Comments

  • KevinLongtimeKevinLongtime Posts: 283
    Nexus 6
    edited December 2016
    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!
  • KevinLongtimeKevinLongtime Posts: 283
    Nexus 6
    edited January 2017
    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.
  • pjennesspjenness Posts: 669
    Neo
    edited January 2017
    Drift VFX Visual, Virtual , Vertical

    Want 970GTX on Macbook for good FPS?
    https://forums.oculus.com/viewtopic.php?f=26&t=17349
  • mfmfmfmf Posts: 56 Oculus Staff
    I updated the sample to fix the issue. (In the original post.)
  • KevinLongtimeKevinLongtime Posts: 283
    Nexus 6
    mfmf said:
    I updated the sample to fix the issue. (In the original post.)
    @mfmf Works perfectly! Thank you!
Sign In or Register to comment.