This module extends the hardware grabbing system available in the VRShared sample, to allow surfaces to block some objects with a tip (pen ,...) while also blocking the hand grabbing it.
BlockableTip component contains a
tip, a child transform, expected to be in the interpolation target hierarchy (as it is a visible object), determining the actual tip (the blocking "point") of the object position.
BlockableTip component detects trigger contact with objects having their layer in the
blockingLayers mask, and having an
From there, the actual contact with the surface is confirmed in
IsInContact by the local coordinates of the
tip in the detected surface referential:
negativeProximityThresholdsdetermine when the contact is effective.
yvalue define the size of the surface, while the
zvalue defines accepted depth of contact (the blocking effect will be along the
zaxis of the surface).
BlockingSurfacemax depth determines at which
zdepth the tip (and grabbing hand) should be blocked
Tip And Hand Blocking
The blocking itself happens in the
FixContactPosition() method: the component defines the target
z position of the tip, so that the depth constraint is respected.
Then, it determines the actual
BlockableTip gameObject position so that the tip finally reaches this target position.
And finally, the hand is moved so that the grabbing initial position is respected.
Note that moves computation differs between
Render(), the interpolation target is moved. The computation is relatively straightforward as the tip is part of the interpolation target.
FixedupdateNetwork(), the actual object is moved (if the option
changeActualPositionis set to true), so the actual position of the tip in the object hierarchy has to be found first.
A demo scene can be found in
The scene contains a surface with a
BlockingSurface component and a grabbable pen with a
Please note that the pen is deliberately not functional in this demo scene.
This addon latest version is included into the addon project
- shared mode
- host mode
- Version 1.0.2: Fix because of feedback namespace modification
- Version 1.0.1: Add demo scene + add verification in BlockingContact to avoid error if feedback is not defined + add namespace
- Version 1.0.0: First release