V_FreeGrabbables can be attached to your GameObjects to allow users to pick them up, carry them around the scene, and even throw them!

<aside> ℹ️ FreeGrabbables share some functionality with the other grabbable types, see the Grabbables page for more information

</aside>

Grabbable Components

This is an grabbable component. Grabbables can be physically grabbed and moved by the player, and have a boolean state denoting whether they are currently grabbed.

<aside> 💡

A key concept of a grabbables are attach points. On grab, the grabbable object will move towards the hand so that the attach point’s position and forward vector matches that of the hand. For example, a sword should be configured such that the attach point is a transform within the hilt, with a rotation such that sword points slightly “up” through the hand, rather than straight forward. This is what makes the sword feel natural to hold.

image.png

</aside>

Inspect Mode

Users often need to rotate a grabbable they are holding to inspect it from all sides. In VR, this is easy, the user can simple bring their hand close to their face and rotate the object intuitively. In 2D, users must use “Inspect Mode”

Right-clicking while holding the FreeGrabbable in 2D will put it in inspect mode. In this mode, mouse movement rotates the GameObject, rather than rotating the camera. Checking “Preserve inspect orientation” will preserve this rotation when the user leaves inspect mode, otherwise, the FreeGrabbable rotation will be reset so that the AttachPoint is facing forwards

Scrolling

In 2D inspect mode, the mouse wheel will move the FreeGrabbable towards and away from the camera, this allows you to easier position the FreeGrabbable. The scroll distance bounds should be configured so that the minimum is high enough that the object isn’t able to clip into the camera when scrolled to its minimum distance, and so that the maximum is low enough that the same effect could be realistically achieved in VR by the user stretching our their arm.

<aside> 🤓 Physics

Depending on your use-case, you may want your FreeGrabbable to behave like a regular physical object, that can be thrown around the scene, or you may wish for it to freeze in the air while not being grabbed. To achieve these effects, you must combine the grabbable’s DropBehaviour with a correct RigidBody configuration.

If you want your grabbable to freeze in the air, you should ensure the RigidBody has gravity = false and isKinematic = true, and the grabbable’s DropBehaviour = Cancel Velocity

If you want your grabbable to behave as a physics-based object, you should ensure the RigidBody is set gravity = true and isKinematic = false, and the grabbable’s DropBehaviour = Inherit Velocity From Hand

</aside>

Code Example

Inspector Config