2

I have a question regarding Unity and mrtk. I need to create an object, which can be deleted via button push. This button should be attached to the object. Now there is the app bar which can be attached to the object and which is very convenient because the buttons are only displayed on the side of the object you currently look at. However the app bar does not seem to work properly with the new bounding box and after deactivating the adjust button on it. So my question basically is, how do i make a button which is attached to the object, hovers on it and is only displayed on the side of the object i am currently looking at? The script of the app bar is very poorly commented, so i cannot figure out which part is responsible for making the button appear on the correct side and correspondingly how to write a script displaying the delete button only on the correct side (following the direction i am currently looking at).

Yannik
  • 41
  • 2

1 Answers1

2

To solve this problem you need a free Canvas that attaches to your object. This Canvas should be adjusted to the dimensions of the object and always look at the camera. To do this, first create a canvas and set RenderMode to World Space, Remember that you have entered the Event camera reference.:

enter image description here


After completing the canvas, make a button like the one below and place it in the body. In this section, adjust the dimensions so that you want to appear in near of your main object.

enter image description here

enter image description here


Finally, I suggest using Look At Constraint to match the canvas and the view to the camera. Insert the camera as source and fix Constraint settings it as shown below.

enter image description here


Example Result

enter image description here

enter image description here

KiynL
  • 4,097
  • 2
  • 16
  • 34
  • Sorry, but please read the question carefully. This is not about normal Untiy programming, it is about mrtk and augmented reality. Your solution makes to sense for this problem. – Yannik May 31 '22 at 12:14
  • @Yannik I read your question again. In this answer, you will learn how to perform this process in Unity. In other plugins only the inputs and the movement of the camera are different, their adaptation is up to you. Also, if you have done any research or have encountered a problem, please fill in the debug information in your question. Otherwise your question will not have a definite answer and will require a tutorial video.[How to ask] (https://stackoverflow.com/help/how-to-ask) – KiynL May 31 '22 at 12:32