Documentation:Pain Box

From UBC Wiki
Emerging Media Lab
UBC Emerging Media Lab Signature.png
About EML
A collaborative space for UBC faculty, students and staff for exploration of emerging technologies and development of innovative tools and solutions. This wiki is for public-facing documentation for our projects and procedures.
Subpages


Introduction

Through this project, we hope to learn more about brain plasticity and suggestibility. The project seeks to emulate the rubber hand phenomena. By extending and replicating the phenomena in a virtual environment, and incorporate the element of pain, we will explore the extent to which physical pain is affected by visual cues. If we can successfully induce pain, we hope to reverse engineer the concept and reduce pain in individuals suffering from chronic pain.

The project initially attempted to represent the box in AR using the Microsoft Hololens. However, we quickly ran into issues with the technology that we believed hindered the level of immersion of the project. The AR work is still available on the EML plastic repository. We then focused on rebuilding the project using a screen mounted on the top of the box. Our main challenge then became convincingly representing the 3D space inside the box on a 2D surface. We believe we sufficiently overcame this, though we would like to revisit the AR direction in the future.

First Time Setup Guide

Required components:

Scripts:

  • GlobalVarController.cs
  • SceneBehaviour.cs
  • HandController.cs

Scenes

  • SplashScreen.unity
  • Mode.unity
  • MainMenu.unity
  • Main.unity

Prefabs

  • Box.prefab
  • HandAnimationMaster.prefab

Animations

  • Back Menu: PanelController.controller, BackMenuActivate.anim, BackMenuIdleOff.anim
  • Hand: HandAnimation.controller, hand stab main.mb, hand stab main2.mb, HorizontalStab.anim, Idle.anim, VerticalStab.anim
  • Main Menu: MainMenu.controller, Idle.anim
  • SplashScreen; SplashScreen.controller

Other

  • Whitney font package
  • EML.png sprite

Set Up:

  1. Ensure all assets above are in the Unity project
  2. Set up the build, and ensure all scenes are in the build settings.
  3. In the player settings, add EML.png to the splash image logo
  4. Build the project for the PC standalone.
  5. Open the build on the EML surface. Ensure it is in a vertical orientation
  6. Place the surface on the painbox mount.
  7. Follow onscreen instructions. Use the provided gloves for greater immersion.

Primary Features....

  • Represent physical box in on Microsoft surface
  • Convincingly represent user's hand on the screen
  • Various animations hurt the virtual hand, which can be synced to physical cues on the box

Further Directions

Non AR

  • Laminate box sides
  • 3D print surface box stand
  • Incorporate Leap and hand tracking
  • Additional pain modalities
  • Desk setup? Replace box with modified desk, with hand tracking underneath the desk
  • Incorporate bio sensing

AR

  • Get AR version of project working
  • Get box set up as a multitarget
  • Look into hand tracking in AR

Artwork

Physical Box Art - All PSDs are available on EML teamshare

AR Box Art - This art was used on the initial conception of the project. The AR component was taken out, but it is provided here for posterity

Plugins/assets/prebuilds developed

Assets:

Scenes:

SplashScreen

Description: First screen the user sees once they open the application. User can either “Exit” or tap “I Understand” and proceed

Assets: SceneBehaviour.cs

Scene dependencies: Scene connects to “MainMenu”.

MainMenu

Description: Main Menu of the application. Displays the title. Additional menu options to be decided, but for now functionality exists in the “Play” and “Exit” buttons which take the user to the “Mode” scene and exit the game respectively.

Assets: SceneBehaviour.cs

Scene dependencies: Scene connects to “Mode”

Mode

Description: The mode screen allows the user to select from the vertical or horizontal simulation. Grayed out buttons suggest that some other simulations can be added at a later date.

Assets: GlobalVarController.cs, SceneBehaviour.cs

Scene dependencies: Scene connects to “MainMenu” and “Main”.

Main

Description: The main scene of the project that contains the hand model, the ruler and the correct camera presets. When the user enters the scene, all they see is the hand model from the established camera angle.

Assets: GlobalVarController.cs, SceneBehaviour.cs, Box model, HandAnimationMaster

Scene dependencies: Scene connects to “Mode”.

Models:

Model - Hands.blend

Description: The bare hands that are used

Other Assets: FabricWool0016_M_Cropped.jpg

Source: https://www.turbosquid.com/FullPreview/Index.cfm/ID/770920, free to use

Model - Ruler.blend

Description: Ruler used in pain simulations

Other Assets: rulerlow_1001_AlbedoTransparency

Source: credit Travis

Model - hand stab main.mb

Description: Includes hand model, ruler model and a surface block. File contains an animation built in for the Vertical stab. Hand model in the animation was replaced by the “Hands.blend” model.

Model - hand stab main2.mb

Description: Includes hand model, ruler model and a surface block. File contains an animation built in for the Horizontal stab. Hand model in the animation was replaced by the “Hands.blend” model.

Scripts:

GlobalVarController.cs

Purpose: Set the value that corresponds to which ruler animation to play on the main scene.

Dependencies: none

Use: Empty script is created with this script attached. That object is then attached to corresponding buttons in the “Mode” scene within their “On Click ()” functionality.

HandController.cs

Purpose: Uses the values set in GlobalVarController to activate hand animations

Dependencies: none

Use: Attached to the HandAnimationMaster object. Values within PlayerPrefs.getInt(“Vertical” or “Horizontal”) assigned in GlobalVarController determine which hand animation to play. Triggered on tap.

SceneBehaviour.cs

Purpose: Allows buttons to either change scene given a string parameter or exit from the application.

Dependencies: none

Use: Attach to dedicated scene manager object. Object can then be inserted in the On Click () on the Inspector tab of any UI Button object.

Animations:

BackMenuActivate

Purpose: Opens back button to return from “Main” scene to “Mode” scene

Use: Triggered a few seconds after the user triggers any of the hand animations.

BackMenuIdleOff

Purpose: Idle animation of the canvas and button in “Main” scene when it’s off.

Use: Invisible to the user. Canvas and “Back” button are too small for the user to see. Default state when entering “Main” scene.

Idle (Menu Button)

Purpose: Idle animation of the active buttons.

Use: Make the buttons light up and dim as to give the impression that they are clickable.

Idle (Hand)

Purpose: Idle animation of the hand in “Main” scene.

Use: State of the hand before the user has tapped the screen. Hand is on full display, ruler is off frame.

Vertical Stab

Purpose: Play the vertical stab animation in “Main” Scene

Use: Triggered after tapping the screen in “Main” if the user clicks on the “Vertical” option in the “Mode” scene.

Horizontal Stab

Purpose: Play the horizontal stab animation in “Main” Scene

Use: Triggered after tapping the screen in “Main” if the user clicks on the “Horizontal” option in the “Mode” scene

Animators

PanelController

Purpose: Controls animations of the Canvas object in “Main” scene.

Animations: BackMenuOff, BackMenuOn, BackMenuActivate

Entry State: BackMenuIdleOff

SplashScreenAnimator

Purpose: Controls animations of the button objects in “SplashScreen” scene.

Animations: Idle

Entry State: Idle

HandAnimations

Purpose: Controls animations of the hand and ruler in “Main” Scene.

Animations: VerticalStab, Idle, HorizontalStab

Entry State: Idle

MainMenuAnimator

Purpose: Controls animations of the button objects in “Main” scene.

Animations: Idle

Entry State: Idle

Prebuilds:

Camera Angles build: available on the teamshare for the project

This build consists of the box and hand assets without animations. The build was created in order to determine the ideal camera for viewing the box, in order to maximize immersion. The following scripts are only for this build, and do not contribute to the final build.

Scripts
CameraPosition.cs

Purpose: Adjusting the position of the camera dynamically with unity buttons, and displaying its transofrmation

Dependencies: VariableController.cs

Use: Attach to the camera in a scene. Ensure transformation is not locked. Create 8 unity buttons and 6 text labels, and 2 sliders. Drag the corresponding sliders into the slots in the inspector

saveCamera.cs

Purpose: Saves the current camera position and rotation to a text file

Dependencies: VariableController.cs

Use: Attach to the camera in the scene. Create 1 unity button and drag into the Save button in the inspector

SceneChanger.cs

Purpose: Change scene on button press, and initialize rotation and position units, and specify text file save path

Dependencies: VariableController.cs

Use: Attach to dedicated scene manager object. VariableController should also be attached to it. Create 1 UI button and 3 UI input fields, and drag them to the corresponding slots on the inspector.

VariableController.cs

Purpose: Store persistent variables across scenes

Dependencies: None

Use: Attach to SceneManager GO. Note that path can either be a formal path (a la C:/users/..) or a string, in which case the path will be a folder of the given name in the build folder.

CameraPresets.cs

Purpose: To provide a set of predefined camera configuration presets which the user can navigate through by pressing the buttons in the scene

Dependencies: None

Use: Attach to the camera in a scene. Ensure transformation is not locked. Create 10 unity buttons and 6 text label. Drag the corresponding sliders into the slots in the inspector.

Scenes in Build
CameraPresets

Description: Scene that gives user the option to cycle through several camera presets

IdealCamera

Description: A scene setup with the most appropriate camera configuration

TestCameraAngleSetup

Description: Scene for setting presets for TestCameraAngle scene

TestCameraAngle

Description: Scene for adjusting camera angles using on screen buttons, and saving ideal angles on the spot

Known Issues

  • In ideal orientation, buttons overlap and go off the screen on the surface
  • Menu buttons are grayed out and not implemented

AR Build

  • AR box is very jittery, bounces around the room
  • Box opacity is very faint, cannot see well over physical box
  • Box multi target doesn't work

White Paper

Upload a .pdf version of the project white paper to the wiki and link to it here.

Poster

Upload a printable version of your poster to the wiki and link to it here. An editable version of the document is preferred.

Development Team

  • Dr. Steven Barnes (Principal Investigator)
  • Abel Waller (Project Co Manager)
  • Penjani Chavula (Project Co Manager)
  • William Beltran (Volunteer)
  • Sean Yilmaz (Volunteer)
  • Travis Anderson (EML in-house artist/animator)


License

Some rights reserved
Permission is granted to copy, distribute and/or modify this document according to the terms in Creative Commons License, Attribution-ShareAlike 4.0. The full text of this license may be found here: CC by-sa 4.0
Attribution-Share-a-like