---
title: HTMLで簡単実装！A-Frameで始めるWebXR開発
tags: 
author: [Takashi Yoshinaga](https://www.docswell.com/user/Tks_Yoshinaga)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/8EDY42X4EG.jpg?width=480
description: HTMLで簡単実装！A-Frameで始めるWebXR開発 by Takashi Yoshinaga
published: June 29, 24
canonical: https://www.docswell.com/s/Tks_Yoshinaga/KDEY76-a-frame-webxr
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/8EDY42X4EG.jpg)

HTMLで簡単実装！
A-Frameで始めるWebXR開発


# Page. 2

![Page Image](https://bcdn.docswell.com/page/V7P6M1PVJ8.jpg)

まずは素材のダウンロード
https://github.com/TakashiYoshinaga/ARFukuoka/raw/main/AFrame_20240629/Sample.zip


# Page. 3

![Page Image](https://bcdn.docswell.com/page/2JV39Y2REQ.jpg)

自己紹介
氏名：吉永崇 (@Taka̲Yoshinaga)
仕事：AR/VR応用に関するR&amp;D。主に医療支援
ウェアラブル・モーションキャプチャ技術開発
趣味：ARを用いたプロトタイピング
活動：ARコンテンツ作成勉強会


# Page. 4

![Page Image](https://bcdn.docswell.com/page/5EG3Z9R67L.jpg)

ARコンテンツ作成勉強会の概要
[形式] AR/VRコンテンツの作り方や関連技術を主にハンズオン形式で体験。
[規模] 参加人数はコロナ前は約5~10名/回、現在は約10~20名/回。
[参加条件] AR/VRの開発に興味があれば初心者大歓迎。専門知識は不要。


# Page. 5

![Page Image](https://bcdn.docswell.com/page/4JQ5LWV27P.jpg)

ハッシュタグ
#tryAR
#aframevr


# Page. 6

![Page Image](https://bcdn.docswell.com/page/K749DKMPE1.jpg)

本題に入ります


# Page. 7

![Page Image](https://bcdn.docswell.com/page/LJ1KZX8X7G.jpg)

A-Frameの概要
p Webブラウザ上でVRなどの3D表現を簡単に実現するフレームワーク
p HTMLのタグを書くだけで3Dオブジェクトを配置できる
p Chrome、Edge、FireFox、Safariなど主要なブラウザで3D表現可能
p スマホやMeta QuestなどのWebXRに対応デバイスではAR/VRも可能


# Page. 8

![Page Image](https://bcdn.docswell.com/page/GJWD9NZK72.jpg)

まずは体験
A-Frameのページにアクセス (https://aframe.io/)


# Page. 9

![Page Image](https://bcdn.docswell.com/page/4EZG931NJ3.jpg)

まずは体験
ページの左側にサンプルがあります
サンプル


# Page. 10

![Page Image](https://bcdn.docswell.com/page/Y76YKXL9EV.jpg)

まずは体験
基本サンプル Hello WebVRをクリック
Hello WebVR


# Page. 11

![Page Image](https://bcdn.docswell.com/page/G75GPX1D74.jpg)

まずは体験
基本サンプル Hello WebVRをクリック
画面をクリック
p 回転：マウスでドラッグ
p 左右：[←][→]キー
p 前後：[↑][↓]キー
※前後左右は自分がどちらに動くかで考える


# Page. 12

![Page Image](https://bcdn.docswell.com/page/9J2Y6X9MJR.jpg)

今⽇のゴール
https://www.youtube.com/watch?v=aAvvqKM0BVI


# Page. 13

![Page Image](https://bcdn.docswell.com/page/DEYG984PEM.jpg)

ハンズオン手順
Step1: 公式サンプルを使ってA-Frameの基本操作を覚える
Step2: CGの見た目の調整やアニメーションの設定などを行い
簡易VRコンテンツを作成
Step3: ハンドマニピュレーションの利用とWebAR対応


# Page. 14

![Page Image](https://bcdn.docswell.com/page/VJNGLQYM78.jpg)

必要なもの
p Webブラウザ → コンテンツの体験や動作確認
p テキストエディタ → HTMLやjavascriptの記述
p Webサーバー → コンテンツの公開
サーバーに関して今回は・・・
p Glitchを利用
https://glitch.com/
u GitHubやGoogleのアカウントがあればOK
u サーバーとエディタの両方を無料で提供
この資料ではGlitchの使用を前提に説明します


# Page. 15

![Page Image](https://bcdn.docswell.com/page/YE9W4DPWE3.jpg)

基本サンプルのコード
Hello WebVRのコードを取得
GET STARTED


# Page. 16

![Page Image](https://bcdn.docswell.com/page/GE8NQ3DR7D.jpg)

基本サンプルのコードの複製
Hello WebVR
Hello WebVRに関する記述 (たったこれだけ！)


# Page. 17

![Page Image](https://bcdn.docswell.com/page/LELPXVM27R.jpg)

基本サンプルのコードの複製
Glitchユーザーはremix the starter example on Glitchをクリック
※Glitch以外の環境ではサンプルのHTMLをコピーし、自作のHTMLファイルにペースト
Click


# Page. 18

![Page Image](https://bcdn.docswell.com/page/4JM4LGY97W.jpg)

基本サンプルのコードの複製
Remix your ownをクリック
Click


# Page. 19

![Page Image](https://bcdn.docswell.com/page/PJRWKZ9979.jpg)

基本サンプルのコードの確認
index.htmlをクリックし、コードが表示されることを確認
Click


# Page. 20

![Page Image](https://bcdn.docswell.com/page/PEXPL9Q37X.jpg)

画面の構成
index.htmlをクリックし、コードが表示されることを確認
ファイルリスト
エディタ
プレビュー


# Page. 21

![Page Image](https://bcdn.docswell.com/page/3EKDLP9NJD.jpg)

補足


# Page. 22

![Page Image](https://bcdn.docswell.com/page/L73R3XWZJ5.jpg)

補足：プレビューが表示されない場合
ブラウザの種類によってはプレビューが表示されない場合があります
ファイルリスト
エディタ


# Page. 23

![Page Image](https://bcdn.docswell.com/page/87DY42K47G.jpg)

補足：プレビューが表示されない場合
画面下方のPREVIEWボタンをクリック
Click


# Page. 24

![Page Image](https://bcdn.docswell.com/page/VJP6M1KVE8.jpg)

補足：プレビューが表示されない場合
Open preview paneをクリック
Click


# Page. 25

![Page Image](https://bcdn.docswell.com/page/2EV39YVR7Q.jpg)

補足おわり


# Page. 26

![Page Image](https://bcdn.docswell.com/page/57G3Z9L6JL.jpg)

ソースの確認
&lt;html&gt;
&lt;head&gt;
&lt;script src=&quot;https://aframe.io/releases/1.6.0/aframe.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a-scene&gt;
表示するオブジェクトや背景の設定をここに記述
&lt;/a-scene&gt;
&lt;/body&gt;
&lt;/html&gt;
p &lt;head&gt; と &lt;/head&gt;の間でA-Frameの読み込みを行う
p &lt;a-scene&gt;と&lt;/a-scene&gt;の間に描画に関する記述をする


# Page. 27

![Page Image](https://bcdn.docswell.com/page/4EQ5LWY2JP.jpg)

ソースの確認
&lt;a-scene&gt; オブジェクト
位置
回転
色
&lt;a-box position=&quot;-1 0.5 -3&quot; rotation=&quot;0 45 0&quot; color=&quot;#4CC3D9&quot;&gt;&lt;/a-box&gt;
&lt;a-sphere position=&quot;0 1.25 -5&quot; radius=&quot;1.25&quot; color=&quot;#EF2D5E&quot;&gt;&lt;/a-sphere&gt;
&lt;a-cylinder position=&quot;1 0.75 -3&quot; radius=&quot;0.5&quot; height=&quot;1.5&quot; color=&quot;#FFC65D&quot;&gt;&lt;/a-cylinder&gt;
&lt;a-plane position=&quot;0 0 -4&quot; rotation=&quot;-90 0 0&quot; width=&quot;4&quot; height=&quot;4&quot; color=&quot;#7BC8A4&quot;&gt;&lt;/a-plane&gt;
&lt;a-sky color=&quot;#ECECEC&quot;&gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
p 基本図形はa-xxxタグで提供されている
p 詳しくは公式ドキュメントを参照
https://aframe.io/docs/1.6.0/primitives
/a-box.html(例：a-boxの詳細)


# Page. 28

![Page Image](https://bcdn.docswell.com/page/KJ49DKWP71.jpg)

アレンジしよう (まだやらなくてOK)
タグ内の各パラメータを編集してCGの見た目を調整することができる
p position(位置)：x y zの順にスペースで区切って指定
x y z座標


# Page. 29

![Page Image](https://bcdn.docswell.com/page/LE1KZXYXJG.jpg)

アレンジしよう (まだやらなくてOK)
タグ内の各パラメータを編集してCGの見た目を調整することができる
p position(位置)：x y zの順にスペースで区切って指定
p rotation(傾き)：各軸を中心とした回転で表現
p color(色)：カラーコード等で指定
p 他にも図形によって各種設定項目がある
(0 1.25 -5)
【設定項目の例】
radius(半径)
width(幅)
Y
height(高さ)
depth(奥行)
Z
原点
X
src (画像など)


# Page. 30

![Page Image](https://bcdn.docswell.com/page/GEWD9NGKJ2.jpg)

とりあえず習うより慣れろ
ということで自由にいじってみましょう


# Page. 31

![Page Image](https://bcdn.docswell.com/page/47ZG93LNE3.jpg)

HTML編集に慣れよう
[編集例]
&lt;a-scene&gt;
角度
&lt;a-box position=&quot;-1 0.5 -3&quot; rotation=&quot;0 45 45&quot; color=&quot;#4CC3D9&quot;&gt; &lt;/a-box&gt;
&lt;a-sphere position=“0 1.25 -5” radius=“1.25” color=“#EF2D5E”&gt;
&lt;/a-sphere&gt;
高さ
&lt;a-cylinder position=&quot;1 0.75 -3&quot; radius=&quot;0.5&quot; height=&quot;0.2&quot; color=&quot;#FFC65D&quot;&gt;&lt;/a-cylinder&gt;
&lt;a-plane position=&quot;0 0 -4&quot; rotation=&quot;-90 0 0&quot; width=&quot;4&quot; height=&quot;4&quot; color=&quot;#7BC8A4&quot;&gt;&lt;/a-plane&gt;
&lt;a-entity position=&quot;0 1.5 -2&quot; scale=&quot;5 5 5&quot; text=&quot;value: tryAR; align: center&quot;&gt;&lt;/a-entity&gt;
&lt;a-sky color=&quot;#555555&quot;&gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
テキスト
色
p a-entityはUnityでいうところのemptyな(空っぽの)
GameObjectという理解でOK
p コンポーネント(先ほどまでパラメータと表現)を
追加して独自のオブジェクトを自作できる
Lesson01


# Page. 32

![Page Image](https://bcdn.docswell.com/page/YJ6YKXW97V.jpg)

ハンズオン手順
Step1: 公式サンプルを使ってA-Frameの基本操作を覚える
Step2: CGの見た目の調整やアニメーションの設定などを行い
簡易VRコンテンツを作成
Step3: ハンドマニピュレーションの利用とWebAR対応


# Page. 33

![Page Image](https://bcdn.docswell.com/page/GJ5GPXMDJ4.jpg)

その前に


# Page. 34

![Page Image](https://bcdn.docswell.com/page/LE3R3X9Q75.jpg)

現在のタブを閉じる
タブを閉じる


# Page. 35

![Page Image](https://bcdn.docswell.com/page/8EDY42GWEG.jpg)

VRコンテンツ作りの準備
Hello WebVRのコードを取得
GET STARTED


# Page. 36

![Page Image](https://bcdn.docswell.com/page/V7P6M13XJ8.jpg)

基本サンプルのコードの複製
Glitchユーザーはremix the starter example on Glitchをクリック
※Glitch以外の環境ではサンプルのHTMLをコピーし、自作のHTMLファイルにペースト
Click


# Page. 37

![Page Image](https://bcdn.docswell.com/page/2JV39Y43EQ.jpg)

基本サンプルのコードの複製
Remix your ownをクリック
Click


# Page. 38

![Page Image](https://bcdn.docswell.com/page/5EG3Z91Y7L.jpg)

index.htmlの表示
index.html


# Page. 39

![Page Image](https://bcdn.docswell.com/page/4JQ5LWD67P.jpg)

不要なオブジェクトの削除
&lt;a-scene&gt;
&lt;a-box position=&quot;-1 0.5 -3&quot; rotation=&quot;0 45 0&quot; color=&quot;#4CC3D9&quot;&gt;&lt;/a-box&gt;
&lt;a-sphere position=&quot;0 1.25 -5&quot; radius=&quot;1.25&quot; color=&quot;#EF2D5E&quot;&gt;&lt;/a-sphere&gt;
&lt;a-cylinder position=&quot;1 0.75 -3&quot; radius=&quot;0.5&quot; height=&quot;1.5&quot; color=&quot;#FFC65D&quot;&gt;&lt;/a-cylinder&gt;
&lt;a-plane position=&quot;0 0 -4&quot; rotation=&quot;-90 0 0&quot; width=&quot;4&quot; height=&quot;4&quot; color=&quot;#7BC8A4&quot;&gt;&lt;/a-plane&gt;
&lt;a-sky color=&quot;#ECECEC&quot;&gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
p HTMLの記述の中から不要なタグを削除す
るだけでオブジェクトが削除される
p このあとの演習の準備のために、
a-sphereとa-skyのみを残して削除
Lesson02


# Page. 40

![Page Image](https://bcdn.docswell.com/page/K749DKZME1.jpg)

外見を整える
単色で塗りつぶすのではなくテクスチャをオブジェクトの表面に表示


# Page. 41

![Page Image](https://bcdn.docswell.com/page/LJ1KZXRY7G.jpg)

外見を整える
テクスチャ画像を用意して、オブジェクトの表面に貼り付ける
3Dオブジェクト
テクスチャ画像


# Page. 42

![Page Image](https://bcdn.docswell.com/page/GJWD9N1172.jpg)

テクスチャ画像をアップロード
Glitchのエディタページにの画面左の列に表示されているAssetsをクリック
続いて、画面上方の[UPLOAD AN ASSET]をクリック
①Assets
補足：
ここに画像ファイルを直接
ドラッグ&amp;ドロップでもOK
② UPLOAD AN ASSET


# Page. 43

![Page Image](https://bcdn.docswell.com/page/4EZG93PXJ3.jpg)

テクスチャ画像をアップロード
Sampleフォルダ内のテクスチャ画像earth.jpgを開く
earth.jpg


# Page. 44

![Page Image](https://bcdn.docswell.com/page/Y76YKXMPEV.jpg)

テクスチャ画像をアップロード
画像をClick


# Page. 45

![Page Image](https://bcdn.docswell.com/page/G75GPXZP74.jpg)

テクスチャ画像のURLを取得
Copy URLをクリック


# Page. 46

![Page Image](https://bcdn.docswell.com/page/9J2Y6XRZJR.jpg)

ソースの書き換え
index.htmlクリック


# Page. 47

![Page Image](https://bcdn.docswell.com/page/DEYG98DNEM.jpg)

ソースの書き換え
&lt;html&gt;
&lt;head&gt;
&lt;script src=&quot;https://aframe.io/releases/1.6.0/aframe.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
colorをsrcに変更
&lt;a-scene&gt;
&lt;a-sphere position = &quot;0 1.25 -5&quot; radius = &quot;1.25&quot; src = &quot;画像のURL&quot;&gt;&lt;/a-sphere&gt;
&lt;a-sky color=&quot;#ECECEC&quot;&gt;&lt;/a-sky&gt;
URLをペースト
&lt;/a-scene&gt;
&lt;/body&gt;
Lesson03
&lt;/html&gt;
p a-sphereの色をcolor(色)ではなくsrc(画像へのリンク)に変更
p srcの右辺に前操作でコピーした&quot;画像のURL&quot;を貼り付ける


# Page. 48

![Page Image](https://bcdn.docswell.com/page/VJNGLQ6V78.jpg)

背景を変更しよう


# Page. 49

![Page Image](https://bcdn.docswell.com/page/YE9W4DLVE3.jpg)

テクスチャ画像をアップロード
画面左の列からAssetsを開き、UPLOAD AN ASSETをクリック
② UPLOAD AN ASSET
①Assets


# Page. 50

![Page Image](https://bcdn.docswell.com/page/GE8NQ3X47D.jpg)

テクスチャ画像をアップロード
サンプルとして用意した背景用画像space.jpgを開く
space.jpg


# Page. 51

![Page Image](https://bcdn.docswell.com/page/LELPXV8V7R.jpg)

テクスチャ画像のURLを取得
space.jpgをクリック


# Page. 52

![Page Image](https://bcdn.docswell.com/page/4JM4LG6N7W.jpg)

テクスチャ画像のURLを取得
Copy URLをクリック


# Page. 53

![Page Image](https://bcdn.docswell.com/page/PJRWKZP479.jpg)

ソースの書き換え
index.htmlクリック


# Page. 54

![Page Image](https://bcdn.docswell.com/page/PEXPL93Z7X.jpg)

タグの追加
&lt;html&gt;
&lt;head&gt;
&lt;script src=&quot;https://aframe.io/releases/1.6.0/aframe.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a-scene&gt; colorをsrcに変更
&lt;a-sphere position = &quot;0 1.25 -5&quot; radius = &quot;1.25&quot; src = &quot;画像のURL&quot;&gt;&lt;/a-sphere&gt;
&lt;a-sky src = &quot;画像のURL&quot;&gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
画像のURLをペースト
&lt;/body&gt;
Lesson04
&lt;/html&gt;
a-skyタグを使用し、背景情報として色の代わりに画像のURLを指定


# Page. 55

![Page Image](https://bcdn.docswell.com/page/3EKDLPYVJD.jpg)

名前を付けて保存
Settings


# Page. 56

![Page Image](https://bcdn.docswell.com/page/L73R3XVQJ5.jpg)

名前を付けて保存
Edit project details


# Page. 57

![Page Image](https://bcdn.docswell.com/page/87DY428W7G.jpg)

名前を付けて保存
Project Nameを変更
最後にSaveをクリック


# Page. 58

![Page Image](https://bcdn.docswell.com/page/VJP6M18XE8.jpg)

URLの確認
①
②Copy Link
→ メモ帳アプリ等にペースト
https://ProjectName.glitch.me がURLとなる
をクリック


# Page. 59

![Page Image](https://bcdn.docswell.com/page/2EV39YN37Q.jpg)

Questでのアクセス方法① (要Metaアカウント)
PCのWebブラウザで下記にアクセス
https://www.oculus.com/open̲url/?url=コンテンツのURL
開く


# Page. 60

![Page Image](https://bcdn.docswell.com/page/57G3Z9KYJL.jpg)

Questでのアクセス方法②
QuestのWebブラウザのアドレスバーにコンテンツのURLを入力
URLを入力
https://ProjectName.glitch.me


# Page. 61

![Page Image](https://bcdn.docswell.com/page/4EQ5LWN6JP.jpg)

動作の様子
VRボタンをタップまたはクリックして没入モードに切り替え
VRボタン


# Page. 62

![Page Image](https://bcdn.docswell.com/page/KJ49DKGM71.jpg)

終了方法
Oculusボタン
Quit
Metaボタン
コントローラのOculus/Metaボタンからウィンドウを表示してコンテンツを終了


# Page. 63

![Page Image](https://bcdn.docswell.com/page/LE1KZXDYJG.jpg)

ハンズオン手順
Step1: 公式サンプルを使ってA-Frameの基本操作を覚える
Step2: CGの見た目の調整やアニメーションの設定などを行い
簡易VRコンテンツを作成
Step3: ハンドマニピュレーションの利用とWebAR対応


# Page. 64

![Page Image](https://bcdn.docswell.com/page/GEWD9NY1J2.jpg)

ハンドマニピュレーション
&lt;body&gt;
&lt;a-scene&gt;
&lt;a-sphere grabbable
position
= &quot;0
1.25 =-5&quot;
radius
src = &quot;画像のURL&quot;&gt;
position = &quot;0
1.25 -5&quot;
radius
&quot;1.25&quot;
src= =&quot;1.25&quot;
&quot;画像のURL&quot;&gt;
&lt;/a-sphere&gt;
&lt;a-entity id=&quot;leftHand&quot; hand-tracking-grab-controls=&quot;hand: left;&quot;&gt;&lt;/a-entity&gt;
&lt;a-entity id=&quot;rightHand&quot; hand-tracking-grab-controls=&quot;hand: right;&quot;&gt;&lt;/a-entity&gt;
&lt;a-sky src = &quot;画像のURL&quot;&gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
&lt;/body&gt;
Lesson05
p hand-tracking-grab-controlsでオブジェクトをつかめる機能を持った手を作成
p つかまれる側のオブジェクトにはgrabbableコンポーネントを追加


# Page. 65

![Page Image](https://bcdn.docswell.com/page/47ZG93XXE3.jpg)

オブジェクトの位置やサイズを調整
&lt;body&gt;
&lt;a-scene&gt;
&lt;a-sphere grabbable position = &quot;0 1.25 -0.5&quot; radius = &quot;0.2&quot; src = &quot;画像のURL&quot;&gt;
&lt;/a-sphere&gt;
&lt;a-entity id=&quot;leftHand&quot; hand-tracking-grab-controls=&quot;hand: left;&quot;&gt;&lt;/a-entity&gt;
&lt;a-entity id=&quot;rightHand&quot; hand-tracking-grab-controls=&quot;hand: right;&quot;&gt;&lt;/a-entity&gt;
&lt;a-sky src = &quot;画像のURL&quot;&gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
&lt;/body&gt;
p a-sphereが5m離れた位置に表示する設定になっているので近くに移動
p サイズも半径1.25mだと大きいので小さくする
Lesson06


# Page. 66

![Page Image](https://bcdn.docswell.com/page/YJ6YKX4P7V.jpg)

動作の様子
リロードした後にVRボタンから没入モードに切り替え
リロード
VR
親指と人差し指でつまむ


# Page. 67

![Page Image](https://bcdn.docswell.com/page/GJ5GPXQPJ4.jpg)

終了方法(再掲)
Oculusボタン
Quit
Metaボタン
コントローラのOculus/Metaボタンからウィンドウを表示してコンテンツを終了


# Page. 68

![Page Image](https://bcdn.docswell.com/page/9E2Y6XPZER.jpg)

AR対応
&lt;body&gt;
&lt;a-scene xr-mode-ui = &quot;XRMode: xr&quot; &gt;
&lt;a-sphere grabbable position = &quot;0 1.25 -0.5&quot; radius = &quot;0.2&quot; src = &quot;画像のURL&quot;&gt;
&lt;/a-sphere&gt;
&lt;a-entity id=&quot;leftHand&quot; hand-tracking-grab-controls=&quot;hand: left;&quot;&gt;&lt;/a-entity&gt;
&lt;a-entity id=&quot;rightHand&quot; hand-tracking-grab-controls=&quot;hand: right;&quot;&gt;&lt;/a-entity&gt;
&lt;a-sky hide-on-enter-ar src = &quot;画像のURL&quot; &gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
&lt;/body&gt;
Lesson07
p xr-mode-uiコンポーネントを追加し、XRModeをxrまたはarとする (詳細)
p hide-on-enter-arコンポーネントを追加しARモードでは背景画像を非表示にする


# Page. 69

![Page Image](https://bcdn.docswell.com/page/D7YG985N7M.jpg)

動作の様子
リロードした後にARボタンからARモードに切り替え
リロード
AR


# Page. 70

![Page Image](https://bcdn.docswell.com/page/VENGLQNVJ8.jpg)

おまけ
3Dモデル(glbファイル)の表示


# Page. 71

![Page Image](https://bcdn.docswell.com/page/Y79W4DRV73.jpg)

3Dモデル(GLBファイル)の表示
&lt;a-scene xr-mode-ui = &quot;XRMode: xr&quot; &gt;
オブジェクトの事前読み込みとキャッシュ
&lt;a-assets&gt;
&lt;a-asset-item id=&quot;cat&quot; src=&quot;3DモデルのURL&quot;&gt;&lt;/a-asset-item&gt;
&lt;/a-assets&gt;
&lt;a-entity grabbable position=&quot;0 1.35 -0.5&quot; scale=&quot;10 10 10&quot; gltf-model=&quot;#cat&quot;&gt;
&lt;/a-entity&gt;
&lt;a-sphere grabbable position = &quot;0 1.25 -0.5&quot; radius = &quot;0.2&quot; src = &quot;画像のURL&quot;&gt;
&lt;/a-sphere&gt;
&lt;a-entity id=&quot;leftHand&quot; hand-tracking-grab-controls=&quot;hand: left;&quot;&gt;&lt;/a-entity&gt;
&lt;a-entity id=&quot;rightHand&quot; hand-tracking-grab-controls=&quot;hand: right;&quot;&gt;&lt;/a-entity&gt;
&lt;a-sky hide-on-enter-ar src = &quot;画像のURL&quot; &gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
Lesson08


# Page. 72

![Page Image](https://bcdn.docswell.com/page/G78NQ3W4JD.jpg)

3Dモデル(GLBファイル)の表示
&lt;a-scene xr-mode-ui = &quot;XRMode: xr&quot; &gt;
&lt;a-assets&gt;
&lt;a-asset-item id=&quot;cat&quot; src=&quot;3DモデルのURL&quot;&gt;&lt;/a-asset-item&gt;
&lt;/a-assets&gt;
&lt;a-entity grabbable position=&quot;0 1.35 -0.5&quot; scale=&quot;10 10 10&quot; gltf-model=&quot;#cat&quot;&gt;
&lt;/a-entity&gt;
&lt;a-sphere grabbable position = &quot;0 1.25gltf-modelコンポーネントでモデルの表示
-0.5&quot; radius = &quot;0.2&quot; src = &quot;画像のURL&quot;&gt;
&lt;/a-sphere&gt;
&lt;a-entity id=&quot;leftHand&quot; hand-tracking-grab-controls=&quot;hand: left;&quot;&gt;&lt;/a-entity&gt;
&lt;a-entity id=&quot;rightHand&quot; hand-tracking-grab-controls=&quot;hand: right;&quot;&gt;&lt;/a-entity&gt;
&lt;a-sky hide-on-enter-ar src = &quot;画像のURL&quot; &gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
Lesson08


# Page. 73

![Page Image](https://bcdn.docswell.com/page/L7LPXVNVJR.jpg)

3Dモデル(GLBファイル)の表示
&lt;a-scene xr-mode-ui = &quot;XRMode: xr&quot; &gt;
&lt;a-assets&gt;
&lt;a-asset-item id=&quot;cat&quot; src=&quot;3DモデルのURL&quot;&gt;&lt;/a-asset-item&gt;
&lt;/a-assets&gt;
&lt;a-entity grabbable position=&quot;0 1.35 -0.5&quot; scale=&quot;10 10 10&quot; gltf-model=&quot;#cat&quot;&gt;
&lt;/a-entity&gt;
&lt;a-sphere grabbable
position = &quot;0 1.25 -0.5&quot; radius = &quot;0.2&quot; src = &quot;画像のURL&quot;&gt;
つかむ場合はgrababbleを忘れずに！
&lt;/a-sphere&gt;
&lt;a-entity id=&quot;leftHand&quot; hand-tracking-grab-controls=&quot;hand: left;&quot;&gt;&lt;/a-entity&gt;
&lt;a-entity id=&quot;rightHand&quot; hand-tracking-grab-controls=&quot;hand: right;&quot;&gt;&lt;/a-entity&gt;
&lt;a-sky hide-on-enter-ar src = &quot;画像のURL&quot; &gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;
Lesson08


# Page. 74

![Page Image](https://bcdn.docswell.com/page/4EM4LGXNJW.jpg)

3Dモデルのアップロード
画面左の列からAssetsを開き、UPLOAD AN ASSETをクリック
② UPLOAD AN ASSET
①Assets


# Page. 75

![Page Image](https://bcdn.docswell.com/page/PERWKZN4J9.jpg)

3Dモデルのアップロード
サンプルとして用意した3Dモデルfigure.glbを開く
figure.glb


# Page. 76

![Page Image](https://bcdn.docswell.com/page/P7XPL9NZJX.jpg)

3DモデルのURLを取得
figure.glbをクリック


# Page. 77

![Page Image](https://bcdn.docswell.com/page/37KDLPNVED.jpg)

テクスチャ画像のURLを取得
Copy URLをクリック


# Page. 78

![Page Image](https://bcdn.docswell.com/page/LJ3R3XZQE5.jpg)

ソースの書き換え
index.htmlクリック


# Page. 79

![Page Image](https://bcdn.docswell.com/page/8JDY42RWJG.jpg)

3DモデルのURLを指定
&lt;a-scene xr-mode-ui = &quot;XRMode: xr&quot; &gt;
ここにURLをペースト
&lt;a-assets&gt;
&lt;a-asset-item id=&quot;cat&quot; src=&quot;3DモデルのURL&quot;&gt;&lt;/a-asset-item&gt;
&lt;/a-assets&gt;
&lt;a-entity grabbable position=&quot;0 1.35 -0.5&quot; scale=&quot;10 10 10&quot; gltf-model=&quot;#cat&quot;&gt;
&lt;/a-entity&gt;
&lt;a-sphere grabbable position = &quot;0 1.25 -0.5&quot; radius = &quot;0.2&quot; src = &quot;画像のURL&quot;&gt;
&lt;/a-sphere&gt;
&lt;a-entity id=&quot;leftHand&quot; hand-tracking-grab-controls=&quot;hand: left;&quot;&gt;&lt;/a-entity&gt;
&lt;a-entity id=&quot;rightHand&quot; hand-tracking-grab-controls=&quot;hand: right;&quot;&gt;&lt;/a-entity&gt;
&lt;a-sky hide-on-enter-ar src = &quot;画像のURL&quot; &gt;&lt;/a-sky&gt;
&lt;/a-scene&gt;


# Page. 80

![Page Image](https://bcdn.docswell.com/page/VEP6M1WX78.jpg)

動作確認


