How can I create a button using mrtk 2.4 and Unity 2019.4 (AR for Hololens) with a custom shape? - unity3d

Hello.
I'm trying to create a button which is shaped in a custom, trapezoid-ish shape.
so far I've tried manipulating colliders on regular MRTK - toolbox buttons, and using
a 3d model as the button (like in Hand Tracking Example 1) with the scripts that the
documentation suggests (NearInteractionTouchable & PressableButton) so far with no success.
So, is there maybe a different way to create a custom shaped button for my Hololens UI?
thanks.

After my test, the guide How to make a button from scratch works fine for me. If you got that issue while using this document, did you adjust the Press Setting after adding the PressableButton component? The default distance data may be invalid, you need to reassign the distance values according to the actual size of your 3D model. If it still cannot work after trying it, please feel free to feedback.

Related

Unity Transparency Sort Axis doesn't work

First, My goal is render sprite objects as below.
So, I set Edit>Project Settings>Graphics>Transparency Sort Mode as "Custom Axis" and Transparency Sort Axis as (0,1,0).
But it only works in the Scene View. When I run play mode, the Transparency Sort Axis I set automatically return to the default value - I mean, Custom Axis + (0.49,-1,0.49). Then the objects' states in the play mode are as below.
I've been suffering from this problem over than a week... because as far as I remember, when I was much more unskilled Unity beginer and tried some tutorials, the setting I set in this way worked in the play mode without any issues.
I think maybe the reason is in the asset I imported because when I made a new project without any asset and tried exactly same procedures, it worked.(transparency sort axis didn't changed automatically during play mode). But I'm still not sure about this problem's reason yet and don't know how to fix it.
Could you please help me solve this problem?

How to get manual camera focus in Flutter

Currently I'm using this library:
https://pub.dev/packages/camera and it has setFocusMode to either Auto or locked, but I need a way to be able to get manual focus mode for camera, where user can tap in camera feed and the focus should be adjusted accordingly.
How do I go about implementing this in my app?
I found this plugin https://pub.dev/documentation/manual_camera/latest/. Does this work? you could use focus distance. If you could get the distance of the object you could set it that way. It's almost like shooting out a ray in game programming. I don't know if this is possible to do but maybe using the size of the objects in the image you could get the distance. someone else has probably already figured this out.

How to create a slider without an outline?

I want to create a slider without an outline.
Like this one:
Note rounded edges.
I assume I need to create a sprite for that. Unfortunately, I can't find any good tutorials on sprites for sliders. I think the easiest way would be to edit the built-in one but I don't know how to get it for editing.
This is how the original slider from my Unity looks like:
Note the outline.
So, surprising solution that should be available to all of us.
Put the default slider in and go to the Source Image for both the Background and Handle. Instead of using what is there, change it to another Unity Standard sprite called TouchpadSprite. This should do the trick. Not sure if the fact that this is called 'touchpad'sprite will cause a problem when make a PC game, but I doubt it. FYI the TouchpadSprite is from the "Standard Assets (for Unity 2017.3)" that is available for free in the Unity Asset Store. Feel free to only import the sprite itself. The Asset Pack itself is pretty large, but there is a lot of good/useful stuff in there.
Also, you will have to increase the Pixels Per Unit Multiplier value. My picture shows what I had to increase it to. This will allow you to choose the rounding of your edges as well. Play with it and let me know if it works.
Hope this helps!

How to draw marks on Unity 3D plane?

I am new to Unity. Sorry if I have a beginner style of question.
I want to implement a 3D Chess game in Unity. I have already implemented a C++ shared library that contains the whole AI thing. I have used this library in WPF and Android and it is tested perfectly. Now it is Unity's turn.
When the user selects a piece, next moves of it should be shown.
These marks can be a light or image. Circular or rectangle.
One way to do this is to have 64 marks per each square of the Chess board and change their visibility programmatically.
The other way, which I personally prefer, is to draw the marks programmatically. But I don't know how to draw on my Chessboard plane.
Please guide me with it.
FINAL RESULT (Just a sketchup!)
STEP BY STEP:
(I assume you have already had a chessboard)
1. Create a Material & configure it like in the below image. Note that the albedo green is 50% transparent:
2. Create a Quad & assign it the newly created Material above. Then set
it up like in the below image:
3. Now we will add the glow effect. First, we need to turn off the
Anti-Aliasing by switching to Good Quality instead of Fantastic.
4. Second, we need to enable HDR in the main camera:
5. Third, we need to import the Image Effects package. This package
is part of the Standard Assets that is shipped with Unity. It is
completely free. Get it here if you haven't.
https://www.assetstore.unity3d.com/en/#!/content/32351
You only need the Image Effect package.
6. Now add the Bloom effect to your main camera.
7. That's it! If you need to hide it via code then get the reference to
it and execute this line of code:
yourQuad.SetActive(false);
See more here:
https://docs.unity3d.com/ScriptReference/GameObject.SetActive.html
8. Finally, duplicate that quad to create 64 ones & position them
properly. There are 2 tricks that can help your life in hell a lot
easier:
To quickly duplicate a group of objects: select all of them and press: Ctrl + D
To enable edge-snap: select your quad and hold down V then hover your mouse over the quad's vertex. You will see a white square around it. Drag that vetex and see the magic.
9. From this on, it is your game logic to implement. You could store
all the quads in a 2-dimensional array (matrix) and manipulate it
yourself, that it all I can think of. Goodluck!

Black 3D Models - Unity3D

I just recently started using Unity3D, and have imported this object from Sketchfab. When I imported it, it provided all the necessary textures and meshes, but it's all black as shown in the images below. It's the same case for any other object I try to add from the asset store. I've tried to fiddle with the light source, but that doesn't seem to work. Thank you in advance.
Edit: This is what my mesh properties looks like. I have selected "pearl_body" and it's still all black.
You need to expand your model in the Hierarchy(left panel) view untill you will see Mesh Renderer component in the Inspector(right panel). Then you will be able to set the material. Probably you will need replace lambert45G in the material view with BaseTexture.
That should fix the problem.
You can read more about materials here, and about mesh renderers.
I had the same problem and found a solution. Not sure if it will work in your particular case, but here it goes:
I had a model that worked fine in unity until I rigged it, then it looked black. What caused this was that I applied a Smooth modifier after the Skin modifier. I solved it by:
Saving the Skin modifier info by clicking on "Save" at the Advanced tab.
Reset Xform / convert to editable poly / smooth modifier (needed in my case as I forgot to use it when the model was finished, before rigging)
Convert to edit poly again.
Apply skin and load the previously saved skin file.
That's all. Cheers!