Skip to main content

Network Grabbable System

1. Overview

The Network Grabbable system provides specialized components for interactive objects that can be picked up by players in the networked environment. It integrates with the hand interaction system and synchronizes physics states across all clients.

For detailed documentation on the base grabbable logic, refer to the underlying Grabbable.cs system:


2. NetworkGrabbable Component

This component inherits from NetworkIdBehaviour and handles the specific networking logic for objects when grabbed by players.

2.1. Hand Offsets

Allows defining specific positional and rotational offsets to ensure the object looks natural in the user's hand.

Figure 1: Configuration of the Network Grabbable component with hand offsets in the Unity Inspector.

  • Grab Position Offset (Left/Right): The positional offset relative to the hand.
  • Grab Rotation Offset (Left/Right): The rotational offset relative to the hand.
  • Use Offsets (bool): Toggles the application of the defined offsets.

2.2. Rigidbody Synchronization

When an object is grabbed, it temporarily becomes kinematic. Upon release, its physics state (Position and Rotation) is restored and synchronized.

  • Force Sleep Sync (bool): If enabled, and the local user is the Master, they can broadcast the simulated physics state once the object's Rigidbody goes to sleep, guaranteeing a definitive final position for all clients.
  • Physics Network Messages: Uses the RigidbodySyncMessage via the EventManagerController to transmit the state over the network.

2.3. Parent Maintenance

  • Maintain Parent Object (bool): If enabled, the object will return to its original parent transform when released, rather than remaining unparented in the scene root.

3. GrabbableObjectManager (Central Controller)

A centralized Singleton (GrabbableObjectManager.Instance) that manages all active NetworkGrabbable objects in the scene.

3.1. Event Handling

It acts as the primary listener for hand interaction events:

  • Subscribes to the HandGrabEvent from the EventManagerController.
  • Upon receiving a grab or release event, it parses the payload and routes the action to the specific NetworkGrabbable using its Network ID.

3.2. Master Authority

The execution of the interaction logic is gated. It processes the event only if:

  1. The local user is the Master.
  2. OR the sender of the event is the session master. This ensures authoritative control over object interaction. If the user is the Master, it automatically forwards the event to all other clients, ensuring state consistency across the network.