Blocking contact
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.
Contact logic
A 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.
The BlockableTip
component detects trigger contact with objects having their layer in the blockingLayers
mask, and having an BlockingSurface
component.
From there, the actual contact with the surface is confirmed in IsInContact
by the local coordinates of the tip
in the detected surface referential:
- the
BlockingSurface
'spositiveProximityThresholds
andnegativeProximityThresholds
determine when the contact is effective. x
andy
value define the size of the surface, while thez
value defines accepted depth of contact (the blocking effect will be along thez
axis of the surface).- the
BlockingSurface
max depth determines at whichz
depth 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()
and FixedUpdateNetwork()
timing:
- during
Render()
, the interpolation target is moved. The computation is relatively straightforward as the tip is part of the interpolation target. - during
FixedupdateNetwork()
, the actual object is moved (if the optionchangeActualPosition
is set to true), so the actual position of the tip in the object hierarchy has to be found first.
Demo
A demo scene can be found in Assets\Photon\FusionAddons\BlockingContact\Demo\Scenes\
folder.
The scene contains a surface with a BlockingSurface
component and a grabbable pen with a BlockableTip
.
Please note that the pen is deliberately not functional in this demo scene.
Download
This addon latest version is included into the addon project
Supported topologies
- shared mode
Changelog
- Version 1.0.3: Improve demo scene
- 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