Immerse

Description

Pickup is a component for enabling an object to be picked up, held and / or thrown by a user. It uses physics, and is automatically synchronised between all users in a session.

For an overview of how the Immerse SDK deals with interactions, see Interaction Overview.

How it works

Pickup uses physics (a Rigidbody and a Collider ) to enable interaction. When a VR user's hand comes in close proximity to the object, the trigger on the controller can be pushed to start the interaction. The user's hand will disappear and the object will move and rotate in synchronisation with the controller. The SDK handles synchronisation of messages across all users in the session and requires no manual set-up.

If a Pickup object needs to be snapped to other objects or geometry in a scene, read the snapping guide for an overview and set-up guide.

Pickup also supports reactions, which allows logic operations to be integrated on various state changes, such as the start of the interaction or when an object is snapped to Snap Targets. More detail available in Reactions and interaction logic section.

📘

Immerse SDK Class Library

More detail in ImmerseSDK.Interaction.Pickupl

How to implement

  1. Select a new GameObject.
  • Reset the Position, Rotation and Scale of the Object. Ensure Position is set to <0, 0, 0>
  • Add a Rigidbody component
  • Add a TransformSync component
  • Set Sync Values to All. This will sync the position, rotation, velocity and angular velocity.
  • Add Pickup component
  • Add one or more colliders to the GameObject - This is used to detect the closest interactive object to the controller

Object handle

Some Pickup object have handles, or must be held in a particular way to make them feel more natural; for example, a screwdriver should be held by it handle and not its tip. For this reason an Interaction Point property can be set to specify a handle transform.

📘

Don't throw it away!

You can restrict the Pickup object to an AABB (Axis Aligned Bounding Box) in world space by using the RestrictPickup component. This will cause the object to snap to it's original location when it goes outside of this box.
Note: You have to enable "snap to origin" on the TransformSync for this to work.

Some common issues

If the object does not move when the trigger is pressed check the following:

  • Is the object's resting position and rotation reset to 0?
  • Does the GameObject have a collider on it? This is necessary for the SDK to detect engagement and for the Rigidbody to work.
    Note: When a collider is missing, the user's hand will not disappear when the trigger is pulled.
  • Are there duplicate scene indices? This can be checked by checking the Scene Object .
  • Is there another collider near to the object that might prevent movement/rotation?
  • Check that the requirements have been set up and are they all met (they should all be green when in Play mode in the Editor Inspector).

Unity Editor Component

Options

PropertyDescription
Verbose Logging Enabled
When enabled, this component instance will log verbosely to the console (only in the Editor). This is useful for debugging, but can have a detrimental effect on the framerate as verbose logging sometimes logs every frame.
IndexThe object's unique index - this will be automatically set by the SDK and should not be edited.
TransformSyncReference to the TransformSymc that object is attached to.
If this is not set (default), then the SDK will look for the TransformSync on the same object.
Requires Two handsOnly after a second hand is engaged will the object move.
Requires Two hands for unsnappingOnly after a second hand is engaged will the object unsnap.
Is Kinematic After EngageHow to treat physics after the player let go of the object.
Interaction RequirementsA set of requirements that need to be met to allow interaction; can be used to disable the object until a particular state is reached. See Interaction Requirements for more details.
Is ThrowableIf enabled, we add a slight up and forward throw force when the user lets go of the object to imitate a flick of the wrist when throwing.
Interaction PointUsually when interaction starts, we keep movement relative to the location where the controller was. If you place a reference to a child transform in here, we will use this instead to calculate relative movement.

Unity iconTry out this component in the Examples project

Examples (menu) > Interactions > Load Pickup Example

Learn more about the Examples project

Updated 4 months ago


Pickup


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.