Folder:Documentation Index
Fetch the complete documentation index at: https://docs-unity.molca.id/llms.txt
Use this file to discover all available pages before exploring further.
Assets/_MolcaSDK/_VR/Scripts/Base/
This page covers the common base-layer scripts used by VR scenes:
MolcaInteractionBase.csTeleportValidator.csPlayerCollisionPrevention.cs
MolcaInteractionBase
File:Assets/_MolcaSDK/_VR/Scripts/Base/MolcaInteractionBase.csNamespace:
MolcaSDK.VR
Abstract interaction foundation for XR interactables. It:
- auto-binds
XRBaseInteractableon the same GameObject (or uses assigned one), - tracks
selectEntered/selectExited, - exposes
UpdateInteraction()for derived classes, - supports optional distance-based force release (
maxInteractionDistance), - registers itself to the reference system after
RuntimeManagerinitialization.
TeleportValidator
File:Assets/_MolcaSDK/_VR/Scripts/Base/TeleportValidator.csRequires:
XRRayInteractor
TeleportValidator gates teleport validity while teleport mode is active:
- applies a configured
interactionMaskto the ray interactor, - listens to active-ray changes via
OnRayInteractorChanged(IXRRayProvider), - checks if controller is colliding near a blocked surface (
CheckSphere), - checks for obstruction between controller and player head (
SphereCast), - disables raycast mask (
0) when invalid to prevent teleport.
Inspector notes
- Wire
OnRayInteractorChangedfrom your controller input manager event. - Set
interactionMaskto geometry that should block invalid teleport traces. - Tune
controllerCollisionRadiusconservatively (default0.05).
PlayerCollisionPrevention
File:Assets/_MolcaSDK/_VR/Scripts/Base/PlayerCollisionPrevention.csRequires:
CharacterController
Helps prevent room-scale clipping into walls/props by checking overlap around the HMD position and nudging the XR origin away from collisions on XZ.
Inspector notes
- Attach to XR Origin root.
- Set
interactionLayerto obstacle layers (walls, furniture, props). - Tune
playerCollisionRadiusbased on headset/body clearance.
Code
Example derived interaction fromMolcaInteractionBase:
Troubleshooting
- Derived interaction never updates - Ensure the object has a valid
XRBaseInteractableand is actually selected. - Unexpected force release -
maxInteractionDistancemay be too small; set to0to disable distance checks. - Teleport still allowed in blocked pose - verify
OnRayInteractorChangedwiring andinteractionMasklayers. - Player jitter near obstacles - lower
playerCollisionRadiusand confirm obstacle colliders are clean (no noisy overlaps).