Open10

BabylonJS Native iOS

イワケンイワケン
git clone --recursive https://github.com/BabylonJS/BabylonNative.git
cd BabylonNative
cd Apps
npm install
イワケンイワケン

まずMacでiOS向け

Required Tools: Xcode 11 or newer, Python 3.0 or newer (required by dependencies)

cmake -B build/iOS -G Xcode -D CMAKE_TOOLCHAIN_FILE=Dependencies/ios-cmake/ios.toolchain.cmake -D PLATFORM=OS64COMBINED -D ENABLE_ARC=0 -D DEPLOYMENT_TARGET=12

ここでエラー

-- Disabling bitcode support by default on simulators. ENABLE_BITCODE not provided for override!
-- Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!
-- Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!
-- Using C compiler: /Library/Developer/CommandLineTools/usr/bin/clang
-- Using CXX compiler: /Library/Developer/CommandLineTools/usr/bin/clang++
-- Using libtool: /Library/Developer/CommandLineTools/usr/bin/libtool
-- Will combine built (static) artifacts into FAT lib...
CMake Error at /usr/local/Cellar/cmake/3.23.2/share/cmake/Modules/Platform/iOS-Initialize.cmake:4 (message):
  iphoneos is not an iOS SDK
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.23.2/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
  CMakeLists.txt:5 (project)

イワケンイワケン

open build/iOS/BabylonNative.xcodeproj

でXCodeを開く。

コードをiOS繋いでPlayを押す。

イワケンイワケン

To select which project to build with Xcode, select the correct project name in the menu to the right of the greyed-out Stop button adjacent to the Play button in the top-left corner of the Xcode window. For example, to build and run the Playground demo app, click on the project selector and find Playground in the list of possible selections. The Play button will subsequently allow you to build, run, and debug the selected Babylon Native demo app.

Xcodeでビルドするプロジェクトを選択するには、Xcodeウィンドウの左上隅にあるPlayボタンに隣接するグレーアウトしたStopボタンの右側にあるメニューで正しいプロジェクト名を選択します。例えば、Playgroundデモアプリをビルドして実行するには、プロジェクトセレクタをクリックし、選択可能なリストの中からPlaygroundを見つけます。その後、Playボタンにより、選択したバビロンネイティブ・デモアプリをビルド、実行、デバッグすることができます。

イワケンイワケン


This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility.

デバイス上のOSのバージョンとインストールされているXcodeのバージョンに互換性がない場合、この操作は失敗することがあります。また、互換性を正しく検出するために、macやデバイスを再起動する必要がある場合があります。


MacOSとXCodeのバージョンを最新にしてビルドしたらできました!!!!

https://twitter.com/iwaken71/status/1531605433819238400?s=20&t=1ZEzSKbdyS_CIGfqB_r5GQ

イワケンイワケン

https://twitter.com/iwaken71/status/1531630241868701696?s=20&t=0-Aj9cJxOhqUZ21Ak9jQ3A

https://github.com/BabylonJS/BabylonNative/tree/master/Apps/Playground/Scripts

ここらへんをいじると変更できます。
↑のサンプルでは、この行をコメントアウトを外しました。

https://github.com/BabylonJS/BabylonNative/blob/18ea83ee51e4e5d8b1763cf8d9ef5b48b2f9bb0a/Apps/Playground/Scripts/experience.js#L61

BABYLON.SceneLoader.AppendAsync("https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/CesiumMan/glTF/CesiumMan.gltf").then(function () {
     //(中略)
});