I'm modeling some boxes with simple rectangles and I use the "on click" property to show information about its contents. However this only works for the 2D view, and I do need to have a 3D view where this functionality is also available because the boxes can be on top of each other.
I noticed that actual 3D objects do not have an "on click" property at all. Is it possible to make objects clickable in a 3D Window?
the only way you can click 3D objects is by adding some 2D element that is clickable on top of it, perhaps with transparent color, which will allow you to click the 3D object in a 2D animation.
Nevertheless in a 3D window, it's definitely not possible to interact with any object through mouse clicking
Nevertheless if you want to display information by clicking an object in 3D you can instead have a text object to display that information in 3D and you can make that object visible or not when you need.
Related
How can you avoid a 3D-object disappear when entering a transparent 3D object? The attached foto shows that a patient disappears when seen from a certain angle, the person 3D-object is not visible. I've tried toggling settings back and forth on patient_presentation in Main and the 3D-objects itself with no luck. Is there a way to force the object to be visible?
Thanks for the comment, Benjamin. Right before I gave up on this, I found that removing the "Illuminate the object" made the 3D object show in the transparent 3D polyline.
Hi I am trying to create custom buttons on unity (trapeziums). I successfully created the visible area on Photoshop and imported it as Sprite 2D UI as per the following image:
The issue arises, when I'm trying to select one of the buttons in game, their border overlap each other, since the transparent area is still being considered as part of the clickable button area. How can I remove this?
EDIT:
Practically when I import I want the squared boxes to not be counted with the image. I need the edges of the orange area to be cut flush with that and not the entire area(i.e. including the transparent boxes).
You may achieve this by using Alpha Hit Test Minimum Threshold. Take a look at this nice video tutorial.
There is one extra step that is not shown in the video but mentioned in the comments: you have to change "Mesh Type" to "Full Rect" and not "Tight" as it is.
Hope that helps.
The clickable area is based on the Rect Transform component of the GameObject. Adjust the width and height to the clickable area you want. You may have to crop your image in photoshop accordingly. If you select 'Gizmos' in the editor you can toggle viewing the click region.
For research purposes, I would like to create a Unity VR 3D application that (more or less) simulates the foveal field of view of a person. This means, in particular, I would like to render the whole environment of the application in the full field of view, but certain objects of interest I only want to render in the foveal area.
For the purpose of explaining the problem, I created a simple 2D picture. Please assume it's 3D. In the picture, the green area is the peripheral field of view, and the yellow area is the foveal field of view. The whole environment, like walls, sky, etc., should get rendered in the green and in the yellow area. Particular objects of interests, here the flowers, however, should only get rendered only in the yellow area and - importand - these objects should get cut off when reaching the green area. With this approach, I want to force people moving their head instead of just moving the eyes.
Any idea how to achieve this? Is it possible to use a kind of mask or filter? Or do I need a stencil shader? I looked around but could not find the correct approach.
I would like to add small text, less than 10 letters to the surfaces of complex 3D models, such as a person model or a building.
One way is to add the image texture to a material, and then add the material to the model. But by this way I can not control where the text will be placed. For example, if I use the material with a text texture to a cube, all the 6 surfaces will display the text. This is what I don't want it be. I just need the text displayed only once, wherever it is.
What I need is just to add some text on the surface anywhere, even randomly.
Can I realize this by Unity itself without other softwares like Maya, Photoshop?
Thanks!
Try using a text mesh and a text renderer ...
http://docs.unity3d.com/Manual/class-TextMesh.html
As always with unity there's a tool for that :)
I'd like to make a "video wall" type application, where multiple images are mapped onto a cylinder, I'd like to then enable each of these images as buttons.
Is this possible? I'm not sure if objects in an openGL space can act as buttons.
sure, it's possible. When the user clicks the opengl context you should be able to get back a x, y location where they clicked. It's then a matter of just doing your projection math backwards to find out what part of the scene they clicked.
You can also render the entire scene to a back buffer with each button set as a different color, then do a glReadPixels from this back buffer at the location of the click. The color value returned is the button they clicked.
And here's an example with a even faster method: http://www.lighthouse3d.com/opengl/picking/
There you only draw the picking buffer when the user clicks the mouse, and only for the single pixel they clicked.
Note: not all of these methods may work with OpenGL ES....so you'll have to pick the one that's right for you.
As a side note, this is also how many FPS games accomplish hit detection.