Kanda Interactions 0.7.1
|
The Grabbable system provides a way to pick up and hold objects in 3D space. It works in conjunction with the interaction and attachment systems to enable natural grab mechanics that work across the network.
The core component that marks an entity as grabbable. When combined with an Interactable, it allows the object to be grabbed using a specific activation type:
To make an object grabbable, add both Interactable
and Grabbable
components:
A grabbable entity needs several components to function:
Grabbable
: Marks the entity as grabbable and defines activation typeInteractable
: Enables interaction with interactorsAttachable
: Handles following the grabbing entity's transformMovable
: Handles movement when attachedInteractable
becomes activeAttachable
component is enabledThe grabbing action is different on PC platform. You can use both Q
button on keyboard and Right Mouse
button to grab objects. Another difference is that grabbing works like a toggle, that is, user presses on Q
/RightMouse
(no need to keep pressing) to grab an object and presses again to release it. For more details refer to player package documentation.
Grabbable objects use the Movable
system for smooth movement. This helps reduce jitter when grabbing networked entities. You can adjust the smoothing by modifying the SmoothMovable
component:
When an object is grabbed, it calculates and maintains its offset from the grabbing interactor. This ensures the object:
Grabbable interactions are networked through the predicted ghost system:
The system uses enableable components to efficiently manage state:
Grabbable
can be disabled to temporarily prevent grabbingAttachable
is automatically enabled/disabled during grab/releaseMovable
handles position updates only when neededConsider using local space attachments for root-level grabbable objects to avoid unnecessary transform calculations.