Skip to content

rowidaEl/VR_Escape_Room

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VR Escape Room – Unity XR Interaction Project

Overview

This project is a VR Escape Room challenge developed in Unity using the XR Interaction Toolkit as part of the Unity VR Development Pathway. The experience focuses on implementing multiple interactive VR mechanics such as button interactions, password validation, object spawning, swipe detection using vector math, and constrained object movement. The player must solve a sequence of interactions to unlock and open the exit door.

Gameplay Objective

The player must unlock the door by completing the following sequence:

1- Enter the correct 4-digit password using the keypad. 2- A keycard spawns on the bench. 3- The player grabs the keycard. 4- The player swipes the card in the reader beside the door. 5- The door lock disappears. 6- The player slides the door open to escape.

Scene Overview

The scene contains several interactive elements:

  • A keypad used to enter a password
  • A display that shows the entered digits
  • A bench where the keycard appears
  • A keycard reader beside the door
  • A locked sliding door

Environment overview

escape1 1

Key Interaction Systems

Keypad Interaction

The keypad allows the player to enter a 4-digit password by pressing physical buttons.

Features implemented:

  • XR button interaction
  • Cooldown system preventing button spam
  • Each button press adds a digit to the password
  • Input is limited to 4 characters

Password Display System

The entered digits are displayed on a screen object inside the scene.

Implementation details:

  • A GameObject acts as the display
  • The display has a TextMeshPro (TMP) child component
  • The TMP text is updated dynamically through a script
  • Each keypad input updates the displayed characters

This provides the player with visual feedback on the password being entered.

Password Validation

When the player enters a password:

  • The system checks if the entered digits match the correct password
  • If correct, a keycard spawns on the bench
  • If incorrect, the system resets and the player must try again

Keycard Spawn System

After entering the correct password:

  • A keycard object spawns on the bench
  • The card is configured as an XR Grabbable object
  • The player can pick it up and interact with the reader

Keypad and password system

escape1 3

Keycard Swipe Detection

The keycard must be swiped through the reader beside the door. The swipe detection uses vector dot product calculations to determine whether the card was moved in the correct direction.

If the swipe direction is correct:

The padlock disappears The locking bar on the door is removed

Incorrect swipe directions do not trigger the unlock.

Sliding Door Mechanic

After unlocking the door, the player must slide the door open manually. The door movement is controlled using direction validation with a dot product.

Features:

The door can only slide in the correct direction Movement in the wrong direction is prevented

This ensures the door behaves like a physically constrained sliding door.

Door unlocking and KeyCard System

escape2 2

Technical Features

This project demonstrates implementation of:

  • XR Interaction Toolkit interactions
  • VR button interactions
  • Object spawning systems
  • Cooldown logic for interactions
  • Dynamic TextMeshPro text updates
  • Password validation logic
  • Swipe direction detection using vector dot product
  • Direction-restricted object movement
  • VR grabbing mechanics

Technologies used

  • Unity
  • XR Interaction Toolkit
  • C#
  • TextMeshPro
  • Unity Input System

About

VR escape room built in Unity using the XR Interaction Toolkit featuring keypad password logic, keycard swipe detection using dot products, and a constrained sliding door mechanic.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors