Heavy Object - Two Handed Grab

two handed heavy grab

How It Works

Our custom two-handed grab scripts use joint physics to realistically simulate carrying heavy objects. To implement this, add the heavy game object to the scene and define two grabbable game objects that will serve as the handles to carry the object. Each grabbable game object must use any kind of joint and be connected to the heavy object.

When implemented, you will be able to pick up the heavy object with two hands only. If you try to grab the object with one hand, the object will forcibly drop. Upon picking up the object with two hands, a transparency will be applied to the object so that you can still see the ground in front of you, which is especially useful when initiating teleporting. One of the custom scripts provides grab model visual indicators that show if you are losing grip of the object by turning green to red, proportional to the amount of force you are exerting on the joint and how much force the joint can withstand.

For example, if the force that you are exerting on the joint is greater than the limit defined in the editor, you would see green controllers become red. If you are exerting a breakable force for too long, the object will drop.

See the ‘Heavy Crate’ game object in Strivr SDK > Examples > Scenes > Interactions Example for an example implementation of this two-handed grab feature.

Developer Setup

  1. Create a game object that will be the ‘heavy object’, or the two-handed grab object.

    • Assign the Ignore Raycast layer to ensure selection happens only via two-hand grabbing.

    • Assign the game object a TwoHandedGrabManagerBehaviour script.

  2. Create the two grabbable game objects that will serve as the handles for picking up the heavy object.

    • Assign each handle the AttachHandleXRGrabInteractable script, which enables grabbing.

    • The handles should also contain any joint component.

    • Give proper values to the Break Force and Break Torque fields of the joint component so the visual indicator will turn red if you’re exerting too much of a break force on the joint.

  3. There are custom settings for both TwoHandedGrabManagerBehaviour and ForceIndicatorXRGrabInteractable scripts.

    • For the TwoHandedGrabManagerBehaviour, you can define:

      1. A relative center of mass for the heavy object.

      2. How long the wait period is before dropping an object if picked up with only one hand.

      3. How long until the heavy object will drop if you’re exerting a breakable force on a joint.

      4. An alpha transparency that will be applied to the heavy object and its game object descendants upon being picked up with two hands.

two handed grab manager behaviour

In order for the alpha transparency to be properly reflected in the heavy object during the two-handed grab, make sure the materials of that game object have their Rendering Mode set to Transparent.

  • For the ForceIndicatorXRGrabInteractable, there’s a Force Grab Indicator Settings section to customize:

    1. The grab model that serves as the visual indicator turning from green to red if you’re exerting a break force on the joint.

    2. The grab model scale.

    3. The grab model alpha transparency.

    4. The joint that determines calculations for the grab model’s color.

force grab indicator settings

In order for the alpha transparency to be properly reflected in the grab model, make sure the materials of the grab model have their Rendering Mode set to Transparent.