Gerry
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    <img align="center" scale="1" src="https://upload.wikimedia.org/wikipedia/commons/9/93/Fibonacci_spiral_34.svg" align="center"> # Dokumentation Detta dokument bör innehålla designbeslut, begränsningar, beskrivning av moduler osv. ## Kort om app ### Specifikation (bör fyllas på) Bör har en kompass som visar vilken riktning gubben är i. När man närmar sig gubben med några meter bör den synas och någon annan visuell feedback bör ges. Gubben ska gå att klicka på. Bör finnas en meter mätare som indikerar hur många meter ifrån gubben man är(Fågelvägen). <img src="https://i.imgur.com/Vs9Q09O.png" align="center"> Kartan över utrymmet(Curiosums planlösning) används av admin för att specificera koordinater eller sätta ut en gubbe(upp till dom som arbetar med det). Då får vi koordinater som vi ska beräkna avstånd till. Vi behöver alltså inte hålla koll på väggar eller något annat som kräver en nav mesh. Vi uppdaterar enbart kompassen och avståndet till karaktären. # Sätt upp projektet ## Installation av test systemet (testbed) 1. Ladda ner senaste uppdatering från git. 2. Installera följande paket. - Om mac. ```bash= /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install node brew install watchman ``` - Om Linux ```bash= apt-get install node apt-get install watchman ``` 3. Kör följande kommando i phone-ar katalogen. ```bash= npm install -g typescript npm install -g react-native-cli npm install react-viro-cli npm install ngrok npm install ``` 4. För att starta server kör `npm start` 5. Ladda ner viro media från google play eller app store för att kunna köra appen i testbed. 6. när du blir sagd att skriva in ngrok koden kan du antigen hitta den på `localhost:4040/status` eller syns det på terminalen enligt följande bild. <img src="https://i.imgur.com/yq1FMJy.png" align="center"> # Filstruktur Baserat på http://www.digitstory.com/react-native-project-structure-a-handsome-way/ https://cheesecakelabs.com/blog/efficient-way-structure-react-native-projects/ ``` phone-ar │ __tests__ └─ android │ bin │ ios │ node_modules ├───test │ └best-test.ts ├───src │ └───lib │ └───ar-component │ ├───assets │ ├───components │ └ArComponent.tsx(den här kommer app1 importera) │ ├───scenes │ ├───styles │ └───utils │ App.tsx │ desc.d.ts /types for react-viro. ``` ## src ``` src ├───assets ├───components ├───scenes ├───styles └───utils ``` ### src/assets Innehåller alla assets som används, så som bilder, 3d modeller osv. ``` src ├───assets │ └───fonts │ └bestfont.ttf │ └───images │ └smile.jpg │ └───models │ └3dsmile.vrx ``` ### src/components Innehåller komponenter i projektet(knappar, input osv) ``` src ├───assets └───components └bestBtn.ts ``` ### src/scenes Innehåller de olika vyerna som används. ``` src ├───assets ├───components └───scenes └───login └index.ts ``` ### src/styles Innehåller olika stilar som används i projektet ``` src ├───assets ├───components ├───scenes ├───styles └colors.ts ``` ### src/utils Hjälpklasser ## System ### Model/Avatar bygg system (Exempel) Exempel på hur ett system som bygger upp avataren kan se ut. ```javascript= let builder = new AvatarModelBuilder(); //anger vilken hatt avataren ska ha builder.setHat({ model:"http://res.com/hat.fbx", albedo:"http://res.com/hat_tex.png" }); //anger vilken tröja avataren ska ha... builder.setShirt({ model:"http://res.com/shirt.fbx", albedo:"http://res.com/shirt_tex.png" }); //... //detta skapar en avatar modell som kan användas av Viro. Model avatar = builder.buildAvatar(); //för att den ska vara kompitabel med Viro kan en // class wrapper skapas. Detta gör den mer generisk och // inte bunden till ViroReact model system. ViroModel m = new ViroModel(avatar); ``` ### Kommunikation system (Exempel) Denna AR app kommer använda ett event baserat system för kommunikation. Ex. ```typescript= import ARComponent from '/lib/ar-component/components/ARComponent.tsx' //... render() { return ( <ARComponent onInitialized={this.onInitialized} onChange={this.onArChange} /> ); } onInitialized(ar: AvatarAR) { //... } onArChange(data : AvatarData) { //... } ``` onInitialized Körs när AR kör och det skickas med ett AvatarAR object. AvatarAR används av App 1 för att komminucera med oss (App 2) och onChange komminucerar tillbaka till App 1. ex. på onInitialized. ```javascript= onInitialized(ar: AvatarAR) { //sets the avatar position. format:{x: number, y: number, z: number} ar.setAvatarPosition({x: 0,y: 0,z: 0}); //hides the avatar. ar.hideAvatar(); /* * Skapar ett nytt text event som avataren kommer att säga * i 1000ms (1 sekund) och sedan försvinna. */ Event event = ar.createNewTextEvent("Hello user!!") .hideAfter(1000) .show(); //gömmer texten så den inte syns. event.hide(); //ar kan sparas undan och användas i andra platser //utanför denna metod. this.arHandler = ar; } ``` onArChange kommer att kallas då någon data har ändrats i AR scenen. t.ex. distancen till avataren, ```javascript= onArChange(data : AvatarData) { data.hasChanged(AvatarData.DISTANCE) // true ifall distancen har // ändras sedan förra onArChange // kallelse. data.distanceToAvatar; // t.ex. 32, vilket är 32 meter till avataren. data.avatarVisible // true om avataren syns på skärmen data.position // position av användaren relativt till start punkten. } ``` Vi behöver veta - Var karaktären ska placeras - Hur karaktären ska se ut De behöver veta - Om användaren är i närheten av avataren och om avataren ska visas To communicate with the ArComponent two callbacks has to be registered on the component. One for sending data to the component and one for receiving. Example code. ```typescript import ARComponent from '/lib/ar-component/components/ARComponent.tsx' class App extends Component { render() { return ( <ARComponent onInitialized={this.onInitialized} onChange={this.onArChange} /> ); } onInitialized(ev: ArEventListener) { //... } onChange(data: AvatarData) { //... } } ``` onInitialized is called when the ArComponent has been mounted and the ArEventListener object in onInitialized is used to communicate with the component. Example of communication. ```typescript onInitialized(ev: ArEventListener) { // Tells the ArComponent to use SLAM technology instead of GPS. ev.useSLAM({ latitude: 0, longitude: 0 }); //sets the avatar position at a gps coordinate. format:{latitude: number, longitude: number} ev.setAvatarPosition({ latidude: 1, longitude: 1.123 }); //hides the avatar. ev.hideAvatar(); /* * Creates a new text event which will display a text for 1000ms (1 second) * and then dissapear. If hideAfter is not given, the event will only be hidden * when called .hide() */ Event event = ev.createNewTextEvent("Hello user!!") .hideAfter(1000) .show(); // Hides the text event. event.hide(); // this.evListener = ev; } ``` onChange is called when data has changed in the ArComponent scene. Example ```typescript onArChange(data : AvatarData) { data.hasChanged(AvatarDataType.DISTANCE) // true is attribute distance has changed. data.distance; // f.ex 32, which is 32 meters from the user. data.avatarVisible; // true if avatar is visible. data.position; // position of the user. } ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully