MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

VR throwing using Manipulation Handler is not functional

Open swhook52 opened this issue 6 years ago • 26 comments

Describe the bug

Using MRTK 2.2.0 in VR with WMR Acer headset and controllers, I am unable to throw an object defined with a Rigidbody and Manipulation Hander and Near Interaction Grabbable with release behavior set to "Everything". The object simply drops to the ground without calculating release velocity and throwing the object.

MRTK Slack indicated this is a feature request, but based on the "Release" behavior indicating what should happen when you let go of the object, I see this as functionality that is lost in VR.

To reproduce

Steps to reproduce the behavior:

  1. Configure a scene with MRTK
  2. Add in the hack to get VR controllers to grab items by changing the MRTK profile to explicitly set "GrabPointer" to include the controller type "Windows Mixed Reality" and "Generic Open VR".
  3. Create a cube with a rigidbody, Manipulation Handler and Near Interaction Grabbable.
  4. Ensure the Manipulation Handler has the "Release" behavior set to "Everything"
  5. In VR, pick up the cube and attempt to throw it.
  6. See that it drops to the ground instead.

Expected behavior

When releasing the cube the "Release" behavior should calculate the velocity of the cube to have it throw in an arc.

Your setup (please complete the following information)

  • Unity Version 2018.4
  • MRTK Version v2.2.0

Target platform (please complete the following information)

  • WMR immersive
  • OpenVR

Additional context

Even the sample hand interaction demos don't allow me to throw objects. They just fall after releasing them.

swhook52 avatar Jan 29 '20 14:01 swhook52

@thalbern @MenelvagorMilsom I thought there was some stuff around maintaining velocity upon release (though maybe this was in the new versions?)

wiwei avatar Jan 29 '20 16:01 wiwei

@thalbern @MenelvagorMilsom I thought there was some stuff around maintaining velocity upon release (though maybe this was in the new versions?)

I believe that's the Release Behavior I'm referencing above.

ManipulationHandler

swhook52 avatar Jan 29 '20 17:01 swhook52

Oh I meant, I remember there were issues with this in the old version (i.e. Manip Handler) but I wasn't sure if some of these were fixed in the newer versions (Object Manipulator)

wiwei avatar Jan 29 '20 18:01 wiwei

I have exact same problem. Are there any simple workarounds to fix it?

lorak41 avatar Feb 14 '20 14:02 lorak41

Mirroring the above comments

Adam7288 avatar May 10 '20 04:05 Adam7288

The current calculation provides velocity to the grabbed object, but one that provided velocity is of controller's velocity which is not same as of the distant grabbed object.

You can check the code submitted in the previous commit

My workaround is to update this code to the ray's hit point instead of the controller's position. OR Calculate the Velocity using a separate script on the Grabbed game object.

chetu3319 avatar May 29 '20 02:05 chetu3319

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

stale[bot] avatar Dec 25 '20 14:12 stale[bot]

@RogPodge Is this fixed by https://github.com/microsoft/MixedRealityToolkit-Unity/pull/9733?

keveleigh avatar May 17 '21 16:05 keveleigh

Should be!

RogPodge avatar May 17 '21 22:05 RogPodge

I've recently come across this issue. Far field input works just as expected however the nearinteractionGrabbable still won't let me throw the object

yifeifang avatar Apr 12 '22 05:04 yifeifang

Are you using the ObjectManipulator? The ManipulationHandler class has been deprecated in favor of ObjectManipulator

RogPodge avatar Apr 12 '22 18:04 RogPodge

I'm using the new object manipulator

Are you using the ObjectManipulator? The ManipulationHandler class has been deprecated in favor of ObjectManipulator

yifeifang avatar Apr 12 '22 18:04 yifeifang

Can you include video and repro steps? #9733 should have addressed this scenario, but if there's a configuration we missed more data would be very helpful to tackle it.

RogPodge avatar Apr 12 '22 20:04 RogPodge

Looking into that PR more, it seems like you may be feeling the dampened velocity effect which occurs when using near manipulation and the object manipulator. We made a decision in that PR to not maintain an objects original velocity when releasing it with near interaction, since you can end up throwing objects somewhat uncontrollably fast. We'll discuss internally whether to change this decision.

RogPodge avatar Apr 12 '22 23:04 RogPodge

I think this is aligning with what I'm experiencing. Where far field works fine but near fields don't really work. Which feels kind weird near field won't be able to throw object. I'm wondering if your team might be able to make a switch for weather enable it or not? Also does the old script has this feature? Where object can be throw by near field manipulations > Looking into that PR more, it seems like you may be feeling the dampened velocity effect which occurs when using near manipulation and the object manipulator. We made a decision in that PR to not maintain an objects original velocity when releasing it with near interaction, since you can end up throwing objects somewhat uncontrollably fast. We'll discuss internally whether to change this decision.

yifeifang avatar Apr 12 '22 23:04 yifeifang

Let me try disable the velocity damping and see if that allows throwing > Looking into that PR more, it seems like you may be feeling the dampened velocity effect which occurs when using near manipulation and the object manipulator. We made a decision in that PR to not maintain an objects original velocity when releasing it with near interaction, since you can end up throwing objects somewhat uncontrollably fast. We'll discuss internally whether to change this decision.

yifeifang avatar Apr 12 '22 23:04 yifeifang

Can you include video and repro steps? #9733 should have addressed this scenario, but if there's a configuration we missed more data would be very helpful to tackle it.

https://youtu.be/LtERfsiGjAc Here is a video demo showed that nearfield didn't work while far field worked just fine. I'm using the lastest MRTK object manipulator script with a rigid body. Release is set to everything image image

yifeifang avatar Apr 13 '22 04:04 yifeifang

        private void ReleaseRigidBody(Vector3 velocity, Vector3 angularVelocity)
        {
            if (rigidBody != null)
            {
                rigidBody.useGravity = wasGravity;
                rigidBody.isKinematic = wasKinematic;

                // Match the object's velocity to the controller for near interactions
                // Otherwise keep the objects current velocity so that it's not dampened unnaturally
                //if (isNearManipulation)
                //{
                //    if (releaseBehavior.IsMaskSet(ReleaseBehaviorType.KeepVelocity))
                //    {
                //        rigidBody.velocity = velocity;
                //    }

                //    if (releaseBehavior.IsMaskSet(ReleaseBehaviorType.KeepAngularVelocity))
                //    {
                //        rigidBody.angularVelocity = angularVelocity;
                //    }
                //}
            }
        }

The video result is after comment out this section of code. Which I think is the velocity damping you have mentioned?

yifeifang avatar Apr 13 '22 04:04 yifeifang

@RogPodge It seems like the MR should fix this issue. However I just updated to the latest MRTK and tried with same setting I still couldn't throw an object with near interactable. Is this desired behavior? Or it's separate issue

yifeifang avatar Jun 02 '22 03:06 yifeifang

Hi, I've had the same problem. Disabling the "Smoothing near" option solved it in my case. Did you try something like that?

BarboraAtVResearch avatar Jun 03 '22 10:06 BarboraAtVResearch