oliver schmahl
    • 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
    # Assignment 4 - More objects to your world (graded) **Date**: 27/02/2022 **Group members participating**: Jakob Overgaard (201706812), Oilver Rask Schmahl (201805260), Tobias Fabrin Gade (201809466) **Activity duration**: 8-10 hours on average per person. ## Goal Our goal for this week was to finilize our concept and to start getting our hands on proper 3D assets to be used in our "Urban Planning" AR application. ## Plan 1. Solve Exercise. 2. Concretize the concept idea. 3. Brainstorm object interaction (rotate, scale, etc...). ## Results **Exercise 1.1** For creating a UI catalogue where users can select different objects to spawn, we create an addition menu button which opens an object selection UI overlay over the users screen - the button simply calls ToggleObjectSelectionUI function when it is clicked. The function for opening and closing the UI can be seen below: (Note: We use an external library called LeanTween, to make the UI animate, by just shifting it's position - this is much more efficient than Unity's animation library, because animations would result in the UI updating every frame, even when it is not animated) ```C# public void ToggleObjectSelectionUI() { RectTransform rectTransform = objectSelectionUI.GetComponent<RectTransform>();; if (_objectSelectionUIToggled == false) { LeanTween.moveY(rectTransform, -rectTransform.rect.height, 0.2f); _objectSelectionUIToggled = true; return; } LeanTween.moveY(rectTransform, 0, 0.2f); _objectSelectionUIToggled = false; } ``` When the objectAdderScript is initialized we create buttons for all prefabs stored in the "spawnable objects" resource folder and add them to the object selection UI menu. Additionally this code is also responsible for adding event listeners for when these buttons are clicked and changing the objectToSpawn variable to the newly selected object. The code for this can be seen below: ```C# private void Start() { // Get all game objects in the resource folder "spawnable objects". Object[] spawnableObjects = Resources.LoadAll("Spawnable Objects", typeof(GameObject)); // For each of these spawnable objects create a button inside the object selection UI to select it. foreach (var spawnableObject in spawnableObjects) { // We get the name of the spawnable object (so the prefabs name in the resource folder). String objectName = spawnableObject.name; // We get the empty game object/UI element which all buttons should be a child of. Transform buttonHolder = objectSelectionUI.transform.GetChild(1); // We take out button template and instantiate. Button newButton = Instantiate(objectButtonTemplate, buttonHolder); // We set the button name to the same as the prefab name newButton.name = objectName; // We get the first child of the button, which is a text element, and change the text to the prefab name var buttonText = newButton.transform.GetChild(0); buttonText.GetComponent<TextMeshProUGUI>().text = objectName; // We add an event listener to when the button is clicked // - when this happens we call the select object function passing the prefab as a GameObject. newButton.onClick.AddListener(() => SelectObject(spawnableObject as GameObject)); } } ``` The function that is called to change the object to spawn is very simple, it simply assigns the selected prefab to the objectToSpawn variable. Code below: ```C# private void SelectObject(GameObject spawnableObject) { // Select object function just changes the object to spawn variable to the newly selected object prefab. objectToSpawn = spawnableObject; // And then removes the UI ToggleObjectSelectionUI(); } ``` At the moment things are functional, however we have some touble understanding how to layer things. The UI for the selection menu is for example correctly placed over the camera, but the spawned objects are rendered in front of the UI - we are a bit unsure how to best solve this. This would be nice to get some hints towards. The object selection in app can be seen in the gif below: **!!!!! Insert gif!!!!!** **Exercise 2.1** For adding animations to the objects, we added a new button under the object manipulation UI that is shown when the object is selected. When this button is clicked a new RotationAnimation script is added onto the selected object, this script is fairly simple and is intended to just be a display animation that lets the user needly see the object rotating. If the script already exist on the object is it removed instead. The code for this can be seen below: The Animation Script: ```C# void Update() { transform.Rotate(0, 50*Time.deltaTime, 0); } ``` Code for adding or removing the objects animation: ```C# public void ToggleObjectAnimation() { if (_selectedGameObject.GetComponent<RotateAnimation>() == null) { _selectedGameObject.gameObject.AddComponent<RotateAnimation>(); return; } Destroy(_selectedGameObject.GetComponent<RotateAnimation>()); } ``` Below is a gif of how it functions in the app: **!!!!! Insert gif!!!!!** **Exercise 2.2** So for the exercise concerning customization of the objects, we have some touble with our concept. Our concept features placing 3D models of architecture for users to walk around and study in smaller scale. Since these models are very large and comprised of many different elements and textures we find it way to cumbersome to add customization to them - what we have chosen to do instead, is to add a cube prefab, that can also be placed next to the achitecture, that will show our solution on the customization exercise and how to change objects materials. Code for changing the material of our object: ```C# public void MaterialToBody() { var objectRenderer = _selectedGameObject.GetComponent<Renderer>(); objectRenderer.GetComponent<MeshRenderer>().material = body; } ``` Below is a gif of how it functions in the app: **!!!!! Insert gif!!!!!**

    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