SONY

In the next step, let's import the Unity Plugin package file (sample program) into Unity and try making an avatar move using the sample app.

  1. Advance Preparations
  2. STEP 1: Start the project
  3. STEP 2: Import the Unity Plugin
  4. STEP 3: Start the sample app
  5. STEP 4: Validate the sample app

Reference

With the sample app, you can capture the motion data sent from the mocopi app via UDP and move an avatar. Deepen your image of Unity Plugin applications and implementation methods by understanding the sample app operation.

Prepare to use the sample app using the following procedure.

  1. Connect the PC (Windows/Mac) on which Unity is installed to the local network.
  2. Access the Downloads page and download the latest version of the Unity Plugin.
  3. Connect the smartphone on which the mocopi app is installed to the local network.
  4. Refer to Sending Data from a mocopi App for the state in which motion data can be sent using UDP from a mocopi app.
    Specify the IP address of the PC on which Unity is installed in the "IP" field, the port number (initial value: 12351) to use in the "Port" field, and "mocopi (UDP)" as the send format.

The advance preparations are now complete.

Creating a new project

  1. Start the Unity Hub and click the [New project] button.
  2. Click to select the "3D" Core.

    Caution

    The sample app only supports SRP (Built-in Render Pipeline).

  3. Configure the necessary settings in the project settings and click the [Create project] button.

The new project is now created and can be started.

When using an existing project

  1. Start the Unity Hub and click the project to use from the Project list.

The project is now started.

  1. Click [Assets]>[Import Package]>[Custom Package...] in that order from the Unity Editor menu bar.
    The Import Package window appears.
  2. Choose the package file (mocopi-receiver-plugin_vX.X.X.unitypackage) in the folder specified for the extraction destination in Step 3 of the Advance Preparations and click the [Open] button.
    The Import Unity Package dialog box appears.
  3. Click the [Import] button.
    The package file is imported into "Assets."
  4. Open [Assets]>[MocopiReceiver]>[Samples]>[ReceiverSample]>[Scenes] in that order in the left pane of the Project window.
  5. Double-click [ReceiverSample].
    The sample app scene appears in the Scene window.

The Unity Plugin is now imported.

  1. Click the [Play] button at the top of the Unity Editor.

The sample app is now started.

  1. Operate the mocopi app to start the UDP transmission of the motion data.
  2. Check that the avatar moves according to the sensor movements.

The sample app is now validated.

Caution

If the sample app avatar does not move, the data may not be received via UDP. Refer to Troubleshooting.