Locomotion validation
This module extends the locomotion system available in VRShared, to validate some locomotion attempts before applying them (locked places, places with limited capacities, restricted area, personal safe zone, ...).
Locomotion validation system
To determine if the user is not trying to go to a forbidden zone, every locomotion system first asks the HardwareLocomotionValidation
component, placed on the HardwareRig
, if they can move to this position, with the CanMoveHeadset()
method. To answer, the HardwareLocomotionValidation
first checks if the move is valid with all its ILocomotionValidator
childs, and all the ILocomotionValidator
childs of the NetworkLocomotionValidation
component, placed next on the NetworkedRig
instance representing the local user on the network.
This allows to have 2 kind of restrictions:
- restrictions to offline data (hardware info, static scene, ...)
- restrictions associated to the networked state of the user
Other restrictions
Additionally, the locomotion is limited by other factor, depending on the locomotion system used:
RigLocomotion
: an user can only teleport on an collider with a layer in the RigLocomotion's locomotion layer mask (like theTeleportTarget
layer)LocomotionValidatedDesktopController
desktop locomotion : for desktop builds, as moves initiated by the keyboard would allow to ignore theRigLocomotion
teleport restrictions, this controller checks that the head position after a move would be correct, by checking:- if it would not be inside a collider after the move
- if a correct walkable navigation mesh point will be under it after moving
Demo
A demo scene can be found in Assets\Photon\FusionAddons\LocomotionValidation\Demo\Scenes\LocomotionValidation.unity
.
The scene contains several areas connected by bridges.
These objects have a different configuration regarding the layer and the navmesh parameters :
- Green objects : set to
Walkable
in Navigation & layer is set toLocomotion
(same as the rigRigLocomotion
LocomotionLayerMask
parameter), so players can move & teleport on them, - Red objects : set to
Not Walkable
in Navigation & layer is set toForbiddenLocomotion
, so players can NOT move or teleport on them, - Orange objects : set to
Not Walkable
in Navigation & layer is set toLocomotion
(same as the rigRigLocomotion
LocomotionLayerMask
parameter), so players cannot walk up to them but they can teleport on it. - Grey cylinders : they are referenced in the
ForbiddenZones
components (HardwareRig
&DesktopRig
). TheForbiddenZone
script demonstrates how to implement theILocomotionValidator
interface. In this example, theCanMoveHeadset()
function ofForbiddenZone
return false when the player head is in the zone area in order to trigger the fader (thanks to theInvalidMoveCameraFader
&HardwareLocomotionValidation
scripts).
Please note that if a player teleports to on orange object, he can then walk on it to avoid being blocked in this area. Then, the locomotion validation will be activated again when the user returns to a green object. If you want to avoid this behavior, make sure that Not Walkable
objects are in the ForbiddenLocomotion
layer.
Download
This addon latest version is included into the Industries addon project
Supported topologies
- shared mode
Changelog
- Version 2.0.1: Fix issue + add minimalDetectedMove parameter
- Version 2.0.0: Fusion 2.0 support
- Version 1.0.2: Improve demo scene with ForbiddenZones
- Version 1.0.1: Add demo scene + add namespace
- Version 1.0.0: First release