Difference between revisions of "Augmented reality"
Jump to navigation
Jump to search
Line 40: | Line 40: | ||
} | } | ||
# Buat empty pada bagian ribbon (code c# drag and drop ke bagian "add component") | # Buat empty pada bagian ribbon (code c# drag and drop ke bagian "add component") | ||
+ | |||
+ | |||
+ | |||
+ | =====Tambah Suara Otomatis===== | ||
+ | Pada bagian DefaultTrackableEventHandler.cs ditambahkan | ||
+ | |||
+ | Pada bagian atas sebelum #region PROTECTED_MEMBER_VARIABLES | ||
+ | |||
+ | public AudioSource aSource; | ||
+ | |||
+ | Pada bagian public void OnTrackableStateChanged | ||
+ | |||
+ | Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found"); | ||
+ | OnTrackingFound(); | ||
+ | if(mTrackableBehaviour.TrackableName == "<nama_image>") | ||
+ | { | ||
+ | aSource.Play(); | ||
+ | } | ||
+ | |||
+ | Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost"); | ||
+ | OnTrackingFound(); | ||
+ | if(mTrackableBehaviour.TrackableName == "<nama_image>") | ||
+ | { | ||
+ | aSource.Stop(); | ||
+ | } |
Latest revision as of 16:03, 14 October 2021
Contents
Install Unity
Daftar Vuforia
Setelah mendaftar, ikuti langkah berikut
- Buat lisensi manager (Get Development Key)
- Buat database (Target Manager)
- Add images to database
- Download database
Unity
Import Database Vuforia ke Unity
- Windows -> Vuforia Configuration
- File -> Build Setting -> Player Settings -> XR Settings -> Vuforia accept
- Copy license vuforia
- Import assets database to Unity
- Pada bagian ribbon Hierarchy, klik kanan -> Vuforia Engine -> Images -> Import
- Tambahkan 3D object,
Untuk versi 2020
- Assets -> Inport Package; Nanti dipilih engine yang versi 10 (tidak bisa jalan, ada error)
- Window -> Package Manager -> Vuforia ENgine AR -> install versi 8.5.9
- Window -> Vuforia Configuration -> add key license
- Import assets (marker, audio, obj) dengan cara drag and drop
- Pada bagian ribbon Hierarchy, klik kanan -> Vuforia Engine -> Images -> Import
- Tambahkan 3D object, dengan cara drag and drop (obj) dan simpan di dalam parent ImageTarget
Tombol Keluar
- Pada bagian ribbon -> tambahkan tombol (setting sesuai kebutuhan)
- Di assets -> klik kanan -> create -> C# script
- Tambahkan di bagian paling bawah
public void QuitApp(){ Application.Quit(); }
- Buat empty pada bagian ribbon (code c# drag and drop ke bagian "add component")
Tambah Suara Otomatis
Pada bagian DefaultTrackableEventHandler.cs ditambahkan
Pada bagian atas sebelum #region PROTECTED_MEMBER_VARIABLES
public AudioSource aSource;
Pada bagian public void OnTrackableStateChanged
Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found"); OnTrackingFound(); if(mTrackableBehaviour.TrackableName == "<nama_image>") { aSource.Play(); }
Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost"); OnTrackingFound(); if(mTrackableBehaviour.TrackableName == "<nama_image>") { aSource.Stop(); }