NavMesh surface does not work for all orientations - unity3d

Unity has video tutorials about this where it claims to simply add NavMeshSurface component to an object and rotate the object to any orientation to get behaviors like walking on walls, etc.
However, this does not work for all orientations. Here is what happens when I try it out for a random surface. Note that I have a script that rebakes the NavMesh for every left mouse button click.
if(Input.GetMouseButtonDown(0))
surface.BuildNavMesh();
Link to view my video
I have a scene in HoloLens2 where walls are generated at runtime and I want a spider to walk on them. So naturally, I want NavMeshes to get generated on walls irrespective of their orientation. Please help.
Add comment

Related

How to solve "No cameras rendering" in Unity?

I am entirely new to Unity. I have a task to work with a tool in Unity. I'm not sure the "Game" is where I should work or the "Scene"? this is how my "Game" tab looks like, but I saw animations in the "Scene" tab. for changing parameters of animation, I should come back to the "Game" tab to change and again go to the "Scene" tab to see the result. I think something is wrong, and I should see the animation in the "Game" tab. Am I right?
It was confusing for me to explain my problem cause I have no idea!
It's very confusing what is happening in your Unity scene.
I assume either you have a disabled camera object or no camera at all.
Search the hierarchy for a MainCamera object and enable it. The game view is rendered from cameras in the application. If you cannot find a camera gameobject, try adding a camera (Gameobject>Camera). If you could find a camera gameobject, you should also check it's Camera component has target display set to Display 1.
In the Scene View at the top left, you can click 2D View. Then you can select the canvas in the hierarchy and press "F", while your mouse is over the scene view, to focus it there. In the end, you should be able to see the canvas in the scene view just as you can in the game view.
In fact, you don't need a camera in the scene to render UI elements, which is quite confusing. So if you don't need to solve the "no camera rendering" problem, as long as there are no 3D objects you want to draw. Keep in mind that you will probably need to manually place an audio listener if you want to hear something at some point.
In your hierarchy window search box write this :
t:Camera
And see if any will show up. The camera needs to be enabled if there is one present. If there is none, then you need to create one from GameObjects -> Camera.
As above answers indicate, there is a missing Camera object. Please keep in mind also that a disabled parent object will affect child objects. This was my case, my Camera object was a child object for a XR Ring object which was disabled and I was getting the "No Cameras rendering" message.

Hotspot visibility in virtual tour for VR headset

I am creating virtual tour for VR headset in Unity - I create sphere and fill it with panoramic photo as material. For every sphere I create hotspots to switch to another scene after looking at it. I was testing it with Oculus Rift DK2. The sphere was visible, but the hotspots were visible all - for all scenes, but I need to see just hotspot for the current scene [1]. Anyone has idea hot to do it? Maybe something with transparency of spheres, but I saw just hotspots, not other spheres, so I think that sphere transparency is ok.
[https://i.imgur.com/F3S9C8w.png] - here you see also other scenes, in VR headset there are only hotspots, the spheres are not visible. This is right, but about hotspots - I need to see just that one for actual sphere, not all.
I was creating virtual tour according to this tutorial: https://tutorialsforvr.com/creating-virtual-tour-app-in-vr-using-unity/ ; you can see there also script for hotspots.
Thank you for all comments.
Make in your script public GameObject scena1Sphere, scena2Sphere, scena3Sphere;. And connect that game object from hierachy to sript fields. Then you can type:
//for first scene
scena1Sphere.SetActive(true);
scena2Sphere.SetActive(false);
scena3Sphere.SetActive(false);
//then when you switch to scene 2
scena1Sphere.SetActive(false);
scena2Sphere.SetActive(true);
scena3Sphere.SetActive(false);
// and for third scene
scena1Sphere.SetActive(false);
scena2Sphere.SetActive(false);
scena3Sphere.SetActive(true);

Show silhouette or outline of player through other gameobjects

I am using an orthographic camera view where the camera follows the player, but does not rotate. When the player goes behind other objects I need a way to still see it. I played with hiding the objects but the prefabs I am using from the asset store do not seem to work well unless they are rendered opaque.
How can I have the player show through other objects, or have an outline or 'ghost' of the player visible?
I would suggest you to use another camera which will have same behaviour (same position/rotation, movement) as your main camera but will only render the player's layer. so when player goes behind other objects, this camera can still see it and make sure it renders on top of everything else using Depth property of camera.
Hope it helps

crosshair pointer enter on vuforia unity project

I have successfully enabled 3d object detection through vuforia in Unity. I have attached a crosshair (reticle) at the centre of the screen in screenspace overlay. when the user moves his phone over the 3d object which is produced upon object detection, I want a label to appear when crosshair crosses different parts of the 3d object. I tried many methods including, collision, cursor and reticle. It is not working.
Is there any easy way to implement this so that I can use event trigger pointer enter to make few things happening on the game.
I successfully solved my problem. The solution is using worldspace crosshair.
Most of the crosshairs available in the assets are cemeraspace. therefore using a worldspace corsshair solved my problem. It may be useful to someone in future.

how to add frictionless effect to an object on a plane

I'm new to Unity and the is working on a personal project. In the following picture, you can see a blue plane in the middle, I want to use it as a ice plane and there should be no friction when user is walking on it. In another way, if I press 'w', the object should move forward until it hits an object. I know there's a built-in function called physic material, but it works only when the plane is tilt at some angle so that the object will slide down from the top to the bottom, but if the plane is placed in a horizontal level it will not work. Anybody has any suggestions for it, thanks.
Answering from my phone and off the top of my head, but look at using input.getaxisraw() to get your direction data then add forces. use triggers to stop the movement when you reach a trigger on another object. There were some good tutorials on Collisions and triggers on unity tutorials. To elaborate more, you can add colliders to the objects that you want your player object to interact with physically. So for your player object you can add code like:
OnTriggerEnter(collider c) {
// stop movement
}