************************************
mocopi Mobile SDK
************************************

mocopiセンサーから受信したデータをもとにモーションデータを生成してアバターを動かすAndroid/iOS向けアプリを、Unityで開発することができるSDKです。

本SDKを利用した場合は、同梱のソフトウェア使用許諾契約書に同意したものとみなします。

------------------------------------
旧バージョンのSDKからアップデートされる方へ
------------------------------------

①不要なファイルの削除
Mobile SDKアップデートに伴い、不要ファイルを削除して頂く必要があります。
Mobile SDKディレクトリをすべて削除して頂くか、以下のファイルを削除してください。
・SelectSensorCountView.cs
・ExperimentalSettingView .cs
・ExperimentalSettingPresenter.cs

②[Android向け開発環境のみ対象]Player Settingsのバージョンを更新する
Mobile SDKは不要なファイル生成を避けるため、アプリバージョン変更時のみファイルの更新を行います。
Mobile SDKを更新する際は、Edit->Project SettingsのPlayerからVersionを必ず変更してください。

------------------------------------
動作環境
------------------------------------

Mobile SDKの動作環境は以下のとおりです。

＜対応プラットフォーム＞
Android 11以降
iOS 15.7.1以降

＜Unityの対応バージョン＞
2021.3.16f1

このSDKはAndroid/iOSのデバイス上でのみ動作します。
Windows/Mac上およびUnity Editor上でmocopiセンサーと接続することはできません。
エディタ上で実行した場合、シーンの遷移の確認ができるStubモードで実行されます。

------------------------------------
ファイル構成
------------------------------------

mocopi-mobile-sdk_vX.X.X.zip
├─ APIReference/index.html  APIリファレンスドキュメント
├─ mocopi_SDK_EULA_JP.pdf  ソフトウェア使用許諾契約書（日本語）
├─ mocopi_SDK_EULA_ENG.pdf  Software End User License Agreement (English)
├─ mocopi_SDK_EULA_Internatinal ENG.pdf  Software End User License Agreement (English)
├─ mocopi_SDK_EULA_CHS.pdf  Software End User License Agreement (Chinese)
├─ mocopi-mobile-sdk_vX.X.X.unitypackage  Mobile SDKのパッケージファイル
└─ Readme.txt  このファイル

------------------------------------
SDKのインポート
------------------------------------

Unityでmocopi-mobile-sdk-vX.X.X.unitypackageをインポートしてください。
TextMeshProのインポート画面が表示された場合は画面のボタンを押してインポートを行ってください。

------------------------------------
サンプルシーン
------------------------------------

本SDKではサンプルシーンを2種類用意しています。

サンプルシーン：
　①全機能サンプルシーン (MocopiMobileSDK\Samples\Scenes\mocopiAllSample.unity)
　②MotionPreview Only サンプル (MocopiMobileSDK\Samples\Scenes\mocopiMotionPreview.unity)

Prefab：
　①Tracking.prefab           ペアリング～トラッキングまでの機能 
　②MotionRecording.prefab    モーション記録機能
　③MotionPreview.prefab         モーション再生機能
　④MocopiManager.prefab      ①~③のprefabを使用するのに必須で必要なPrefab
　⑤MotionPreviewContents.prefab ③のPrefabを使用するのに必須で必要なPrefab

以下はPrefabを配置して、サンプルシーンと同等のものを作成する手順です。


＜全機能サンプルシーンの作成手順＞

■Sceneの設定 

【1】シーンの作成 

　1.新規シーンを作成する 

  2.BuildSettingを開く 

　3.Scenes in Buildに作成した新規シーンを追加 

　4.PlatformをAndroidまたはiOSに変更   

 
【2】プレハブの配置 

  1.ProjectのAssets->MocopiMobileSdk->Prefabを開く 

　2.MocopiManagerプレハブをヒエラルキーに配置する 

　3.Trackingプレハブをヒエラルキーに配置する 

　4.MotionPreviewプレハブをヒエラルキーに配置する 

　5.MotionRecordingをヒエラルキーに配置する  


【3】Trackingプレハブにオブジェクトをアタッチ 

　1.ヒエラルキー->Tracking->MainReferenceManagerを開く 

　　以下オブジェクトをMainReferenceManagerスクリプトにアタッチ 

　　　①ヒエラルキー->MotionPreviewをMotionPreviewPrefabにアタッチ 

　　　②ヒエラルキー->MotionRecordingをMotionRecordingPrefabにアタッチ 


【4】MocopiManagerにAvatarをアタッチ 

　1.Project内でSportyRAYNOS_chan_v1.0.0PS1.01を検索 

　2.SportyRAYNOS_chan_v1.0.0PS1.01をヒエラルキーに配置 

　3.SportyRAYNOS_chan_v1.0.0PS1.01のインスペクターにMocopiAvatarコンポーネント追加する 

　4.ヒエラルキー->MocopiManagerのMocopiAvatarにSportyRAYNOS_chan_v1.0.0PS1.01をアタッチ



＜MotionPreview Only サンプルの作成＞

【1】シーンの作成 

　1.新規シーンを作成する 

  2.BuildSettingを開く 

　3.Scenes in Buildに作成した新規シーンを追加 

　4.PlatformをAndroidまたはiOSに変更   


【2】プレハブの配置 

  1.ProjectのAssets->MocopiMobileSdk->Prefabを開く 

　2.MocopiManagerプレハブをヒエラルキーに配置する 

　3.MotionPreviewContentsプレハブをヒエラルキーに配置する 

　4.MotionPreviewプレハブをヒエラルキーに配置する 

　5.4で配置したMotionPreviewオブジェクトをアクティブにする 


【3】MotionPreviewContentsプレハブにオブジェクトをアタッチ 

　1.ヒエラルキー->MotionPreviewContents->MainReferenceManagerを開く 

　　以下オブジェクトをMainReferenceManagerスクリプトにアタッチ 

　　　①ヒエラルキー->MotionPreviewをMotionPreviewPrefabにアタッチ 


【4】MocopiManagerにAvatarをアタッチ 

　1.Project内でSportyRAYNOS_chan_v1.0.0PS1.01を検索 

　2.SportyRAYNOS_chan_v1.0.0PS1.01をヒエラルキーに配置 

　3.SportyRAYNOS_chan_v1.0.0PS1.01のインスペクターにMocopiAvatarコンポーネント追加する 

　4.ヒエラルキー->MocopiManagerのMocopiAvatarにSportyRAYNOS_chan_v1.0.0PS1.01をアタッチ 


------------------------------------
ビルド設定（Androidビルド用） 
------------------------------------

BuildSettingsのPlayerSettings->Player->Settings for Android内

・Other Settings->Identification->MinimumAPILevel : Android11.0(APIlevel30)
・Other Settings->Identification->TargetAPILevel : APIlevel33
・Other Settings->Configuration->ScriptingBackend : IL2CPP
・Other Settings->Configuration->ApiCompatibilityLevel : .NETFramework
・Other Settings->Configuration->TargetArchitectures->ARMv7 : オフ
・Other Settings->Configuration->TargetArchitectures->ARM64 : オン
・Other Settings->Publishing Settings->Custom Main Manifest : オン
・Other Settings->Publishing Settings->Custom Main Gradle Template : オン
・Other Settings->Publishing Settings->Custom Gradle Properties Template : オン

Assets/Plugins/Android/mainTemplate.gradle内のdependenciesに下記を追加

 implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41'
 implementation 'com.google.code.gson:gson:2.8.9'
 implementation 'androidx.documentfile:documentfile:1.0.1'
 implementation 'androidx.appcompat:appcompat:1.3.1'

Assets/Plugins/Android/gradleTemplate.properties内に下記を追加

 android.useAndroidX=true

Assets/Plugins/Android/AndroidManifest.xml内

<manifest>に下記を追加

 <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
 <uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
 <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
 <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />

<application>に下記を追加

 <activity android:name="com.sony.mocopilibrary.recorder.MocopiRecorderActivity"
   android:label="MocopiRecorderActivity">
 </activity>

------------------------------------
ビルド設定（iOSビルド用） 
------------------------------------

Mobile SDKを組み込んだプロジェクトをビルドすると、以下のプロパティがInfo.plistに追加されます。

iOS13以降

　Privacy - Bluetooth Always Usage Description
　Value: mocopi Mobile SDK uses Bluetooth.

iOS12以前

　Privacy - Bluetooth Peripheral Usage Description
　Value: mocopi Mobile SDK uses Bluetooth.

全バージョン共通

　Privacy - UIFileSharingEnabled
　Value: true
　Privacy - LSSupportsOpeningDocumentsInPlace
　Value: true

また、アプリケーションがバックグラウンドになってもmocopiからのセンサーデータの受信が途切れないよう、
info.plistの"Required background modes"に"Add communication using CoreBluetooth"も追加されます。


------------------------------------
利用上の注意
------------------------------------

mocopiセンサーのファームウェアバージョンが古い場合、SDKが正しく動作しない可能性があります。
mocopiアプリを利用してセンサーファームウェアのアップデートを実施してください。

最新情報はmocopiデベロッパーサイトをご確認ください
https://sony.net/mocopi-dev
