This is a new React Native project, bootstrapped using @react-native-community/cli
.
We use Viro library that detects and displays images and objects in real-time, presenting lifelike 3D models through augmented reality (AR)🕶️
Note: Make sure you have completed the React Native - Environment Setup instructions till "Creating a new application" step, before proceeding.
# using npm
npm install
# OR using Yarn
yarn install
# if you cant install, try:
npm install --legacy-peer-deps
You need to use real device to test or run this app.
# using npm
npm start
# OR using Yarn
yarn start
To add new model to project:
- Create new folder in
assets/images
folder. Example:assets/images/bohuc
- Add labels images of your model in this folder. Example:
assets/images/bohuc/bohuc1.jpg
- Create file:
{your_model}_images.tsx
inutils
folder to define your model's images url. Example:src/utils/bohuc_images.tsx
I recommend you use chatGpt to generate url, you can follow my format in this file. - In
DetectObject.tsx
file, import your{your_model}_images.tsx
file. - Add your model's infomations and images inside
utils/object_map
file.
Rebuild your project to see the result.
If app detect model successfully, it will show a text "Found Object {your_model}..." on screen.
Expamle Log:
[LOG] Found Object bohuc {"anchorId": "49264808", "position": [-0.01319042220711708, -0.3073541224002838, -0.43637239933013916], "rotation": [36.71136178875351, -13.227428870237672, 24.101736335548186], "scale": [1, 1, 1], "trackingMethod": "tracking", "type": "image"}