Microsoft HoloLens Tutorial, cursor on own object - unity3d

I'm starting to develop for the Microsoft HoloLens. For that, I made the Tutorials from the Hololens Academy. This worked fine.
Now I want to use a simple 3D Sphere instead the astroman and add the cursor from the academy source code. My problem is that the cursor is not visible while its on the sphere. Sometimes I can see the cursor at the border of the sphere.
If the cursor is not pointing on the sphere, its visible. Like in the tutorial its a star then.
Steps to Reproduce:
Follow the tutorial Holograms 210 Chapter One. In step "Setup the scene" Don't add AstroMan, SpaceAudioSource and SpaceBackground. In hierarchy click Create --> 3D Object --> Sphere. Then place the sphere in front of the camera X: 0, Y0, Z3. And scale it to X=Y=Z=0.2. Then follow the tutorial chapter 1 to the end.
What do I wrong? I tried to add Material, select the Trigger checkbox... It's not working.
Thanks a lot for every kind of help.
Cursor not centered on sphere:
Cursor centered on sphere:
SOLUTION
Thanks to the answer from #Cameron Vetter I found my mistake.
My collider was exactly the same size like the mesh render. So the cursor and the mesh where exactly on the same height. Thats why I could not see the cursor on the object.
I removed the standard collider and added a box collider. Then I scaled this box collider a bit greater than the mesh (1.05) each axis. Now it works!

The cursor uses the unity collider to determine if it hits an object by raycasting from the viewer's perspective out and seeing if it hits any colliders. My guess is that you did not add a collider to your sphere.
In unity select your sphere in the hierarchy and click add component in the inspector. Add a Mesh Collider and everything should just work.
In real world use cases you would want to use a sphere collider instead of a mesh collider. They are less processor intensive but will require you to setup the center and radius properly.

Related

Player falls halfway throufh the floor till the outer edge of collider. instead of the inner edge

As you can see in the included video the player falls over the floortile till the outer edge of the floor. Instead it should stop at the inner edge of the tile so it looks like its standing ontop of the tile. Can anyone help? I cant find anything on the internet regarding my issue.
Im sorry if this is a easy fix. Im a beginner. This for a school project :)
Video: https://streamable.com/99jz2o
enter image description here
Photo of sprite standing on the wrong edge of the tile.
Edit: I went back to the tile palette and redrew the level. This time selecting the game object + bitmap again. Now it works. Probably the reason why it didn't work was that when I drew the level I had not added Tilemap Collider 2D and Composite Collider 2D. Now redrawing with those 2 components added it works as it should!
The problem is with your tile map collider. Instead of using this, set empty game objects as children of the objects that make up the . Then, add BoxCollider2Ds to each one, and add scale them to fit the map. If that doesn’t work, then it is either a problem with the rigidbody, or the box collider, make sure that all of the settings are set to default, then slowly change them back, and you will discover what is causing the problem. Then you can comment on this post what variable changed it.
Your issue is the Composite Collider. The docs specify that they
do not define an inherent shape. Instead, it merges the shapes of any
Box Collider 2D or Polygon Collider 2D that you set it up to use
When you attach a BoxCollider2D or PolygonCollider2D, there is a check box on them that specifies Used by Composite. When checking this box, other fields will disappear as they are now controlled by the CompositeCollider.
To use this collider, make a new object that will hold all your other colliders or make a few that hold sections of your map. Give this new parent object a CompositeCollider2D and give all the children BoxCollider2D or PolygonCollider2D. After this, make sure to check the box Used by Composite on the children Colliders.
Edit: Sorry just saw you were using a Tilemap. Just make the CompositeCollider a parent of your Tilemap while keeping the Used by Composite checked.
Edit 2: I am not too familiar with Tilemaps with Composite Colliders, but one other solution you can try before re-childing is changing the Geometry Type field on your CompositeCollider from Polygons to Outlines.

Collider for blender pot model inside Unity

i've made a simple pot model inside blender:
So the idea is that after importing to unity, generating mesh collider, adding ridgin body i would like to be able to put smothing inside the pot. Now it's generating collider but without a "hole" inside, so if i throw smth inside it just bounce off the top. Is there any way to do it simple way? I'd like to avoid making a collider by hand in unity, using cubes and so...
Image overview:
Your collider needs to be concave
It isn't clear from your question how you're "generating mesh collider," but the results are clearly generating a convex collider.
That said, some things to know about mesh colliders (and concave ones even more so): They are very compultationally heavy to calculate, so they should never...
move
scale (especially non-uniformly)
rotate
...at runtime.
Alternatively you can use multiple box colliders in the same orientations as the side-segments of your can (along with one or two for the bottom, depending on how small of an object you'll be dropping inside).
Uncheck the generate collider box from the import settings, add a mesh collider component and check convex.
I would use four or six box colliders for the walls of the pot and another for the floor. You can scale each box collider along each axis, but if you want to rotate a box collider you will need to give it a parent and rotate the parent. Box colliders are very low cost for the physics engine compared to mesh colliders.

Unity with Bullet Physics : Mesh Collision

I am trying to use Mesh Collision with a cube with hole model that created from Blender and export it to .fdx then import to my Unity project
Following this doc. http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes
I am using bConvexHull for this object.
I drag the mesh into the field and press Build Mess. No error.
And set BRigitBody to make it stay still.
After that i create a small red cube on top of the first object. And set BRigitBody to make it fall down to the first object.
After hit Play button, The red cube should fall down into the hole of the first object.
But it just stay on top like this
What i have missed or did it wrong?
Please give me some explanation.
Thanks.
A convex collider, by its definition, cannot have holes.
Use btBvhTriangleMeshShape instead.

ARCore custom object not touching the tracked plane with bottom

I am experimenting with the ARCore SDK inside Unity to make an Augmented Reality app. As a start I ran the HelloAR Demo app where the ground is detected and onto which you can place multiple Andy's when tapping on the screen. I notice the Andy's are placed on top of the plane, as it should.
Now, I create a 3D Cube object and replaced the Andy prefab with the Cube. This places Cubes instead of Andy's in the app. However, I notice that the bottom of the cube is not touching the plane! The plane runs through the center of the cube, which is not an ideal scenario!
I looked on the internet for a solution, but haven't found it yet. On another website there was someone with the same issue, but no solution was provided. Only a reponse stating that it works only with the ARCore demo objects, not with custom objects.
Can someone help me out on this one?
Thanks!
I have found the solution to my problem.
The pivot point of my Cube GameObject was in the center. All I did was wrap an empty GameObject around the Cube and repositioned the pivot point to the bottom of the Cube. From this I created a Prefab and used it inside the app. Now the cubes are placed correctly on top of the plane.
One thing I do is any objects that don't have centers where they should be, is to load the .obj into blender, and move it to the center of world axes. I might also tell it "center to geometry" before centering on world axis, then I export as .obj (selection only).

How can I export a cylinder from Blender to Unity 3D to be like a Unity 3D cylinder?

In Unity 3D I make GameObject → 3D Object → *Cylinder. And this cylinder has the components: Cylinder (Mesh Filter), Capsule Collider, and Mesh Renderer. I can add the last two components to my exported cylinder from Blender, but I can't add the Cylinder (Mesh Filter) component. What is Cylinder (Mesh Filter)? Is it just a Mesh Filter component?
Now I have some problems. I created some Cylinders in Blender. All of them I did using Knife Project. And the last step was to click on Delete → Faces. If I'm not clicking on Delete and make delete faces, it will not cut the hole.
The first problem is in the first cylinder I created in Blender. I cut a simple circle hole, and it's working fine exported it to Unity 3D. But the next cylinders I exported for some reason, when I'm looking at them from the front, are hollow. I see the other side outside, but if I'm moving around from the back, it's not hollow. I am not sure why.
In this screenshot are the cylinders I exported and they are in Unity 3D. The one that is fine is on the left. The others on the right hollow like. The hole cut was to the other side, but if I will look from behind, it's not open in the back:
Back:
The cylinders on the right I changed the circle. The one on the left I didn't change; it only rotated it.
My main goal in the end is to create a cylinder in Blender with just a hole I can walk inside with my character in Unity 3D.
The on the left seems fine, but the hole is too small and high, so I can't walk in.
In Blender it looks fine only in Unity. It looks hollow side to side from the front:
The problem is not the normals.
Unity does not render backfaces. Faces have front and back sides, and game engines don't render back sides by default for optimization reasons. Your mesh is not watertight, and from the hole you are seeing the back side of the faces of the other side.
The first cylinder looks fine, because it has volume, so it's watertight and its backfaces are hidden inside it.
Solution 1: in Unity, set the cylinder's material as double-sided. This will tell Unity to not disregard backfaces that use this material.
Solution 2: in Blender, extrude all faces of the cylinder a bit so that it has some volume to it. This way, the mesh will be watertight, so there will be no backfaces visible (backfaces will be hidden inside the model).
Regarding collision problems;
if you want a character to be able to walk inside the cylinder, but not through its walls, do solution 2 and put a "mesh collider component" on the cylinder in Unity. This will make each face collideable instead of wrapping a simple 3D object around the model as the collider.
You simply need to flip your Normals in Blender. That is the reason you are seeing this effect in the whole of your cylinder. Follow this tutorial for the inside faces of your cylinder.