Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Use the PSMove plugin in a UE4 project

Chadwick Boulay edited this page Sep 15, 2015 · 24 revisions

Prerequisites

You will need an IDE that works with UE4. In Mac this is XCode (use App Store), in Windows this is Visual Studio.

If you wish to use Git to stay synchronized with this repository then you will need to install Git too. This is optional and instead you may download the Plugin in zip form (see Notes below). I leave it up to you to learn about Git if you so choose.

You need the Unreal Editor (click on Get Unreal on this page). Unreal Editor >= 4.9 is required.

Testing out my demo project

See SimpleUE4PSMove

Installing the plugin in a new project

If you already have a C++-based project, skip to step 3.

  1. Launch the Unreal Editor
    • I typically do it from the "Epic Games Launcher"
  2. Create a New Project (1)
    • It must be a C++ project (2)
    • Use the "Basic Code" template (3)
    • No Starter Content (4)
    • Make a note of where it is storing the project (5). e.g., C:\Users\<username>\Documents\Unreal Projects\MyProject
    • Create the project (6)
    • This will probably open the IDE (Visual Studio for Windows, XCode for Mac) and the editor.
    • New project
  3. Close the IDE (and save changes if asked).
  4. Add the plugin
    • In your project directory (noted above), add a 'Plugins' folder. e.g., C:\Users\<username>Documents\Unreal Projects\MyProject\Plugins
    • Download this repository into the Plugins folder. Rename the folder created from this repository as 'PSMovePlugin'. See Notes below.
  5. Refresh your code project.
    • In Windows, close the editor. In the project folder, right click on the <projectname>.uproject file (e.g., C:\Users\<username>\Documents\Unreal Projects\MyProject\MyProject.uproject) and choose "Generate Visual Studio Project files".
    • In Mac, still in the editor, click on File->"Refresh XCode Project"
    • In Mac, close the editor.
  6. Build the project.
    • Open the project in the IDE (Windows: double-click on (e.g.) MyProject.sln).
    • Set the build target to Desktop>DevelopmentEditor
    • Build & Debug the project (Windows: Press F5). This will launch the debug editor.

Assuming the project builds correctly, it should no longer be necessary to build and debug the project, unless you are making changes to C++ code.

Using the PSMove component in a new project

  • Drag an empty actor object into the scene then place it at 40,0,100.
  • Rename to "Controller"
  • Click on Add Component then select a "Motion Controller" component. (Only available with UE >= 4.9)
  • Replace the default root component with the MotionController component.
  • As a child of the MotionController component, add:
    • A PSMove component (Only available if this plugin is installed correctly)
    • A scene component. As a child of the scene component, add
      • A Sphere (static mesh)
      • A Cube (static mesh)
  • Click on the blue Blueprint/Add Script button, and then Create Blueprint
  • Open the viewport
    • On the left select the sphere and on the right scale the sphere to 0.045, 0.045, 0.045
    • Select the rectangle component, locate it to -10,0,0 and scale it to 0.15, 0.03, 0.02
  • Ensure that both the MotionController component and PSMove component have the same Player Index (0) and Hand (Right).

At this point you should have an object that moves around the player under PSMove control.

Optional

Wire up the BluePrint as in the following diagram to get the following features:

  • Circle button cycles through tracking colours
  • Move button resets yaw (and position if not using HMD)
  • The controller vibrates when the trigger is held
  • The actor disappears when tracking is lost.

PSMoveBluePrint

Notes

Getting the plugin files into your project

Two options:

  1. Use git
    • In a console window in the Plugins folder, run git clone https://github.com/cboulay/psmove-ue4.git
    • Rename the folder. Mac/Linux: mv psmove-ue4 PSMovePlugin; Windows: rename psmove-ue4 PSMovePlugin
  2. Download the zip
    • At the bottom of the right column in the main repository page there is a button to "Download ZIP". Click on that and download the file somewhere.
    • Extract the 'psmove-ue4-master' folder into your project\Plugins\ directory.
    • Rename the folder to PSMovePlugin.
    • See below example.

Project and plugin folders