Sphere collider but hollow inside - unity3d

I want the sphere 2 to be hollow inside, so that the sphere 1 can proceed physics inside.
But I don't know which collider to use.

you could create a Sphere in a 3D modelling software and invert the normals so that they face inside the sphere. in unity place the sphere with the inverted normals as a child to your hollow sphere. this will represent now the inner side of your hollow sphere. remove the meshrenderer and add a meshcollider to the sphere with the inverted normals. now you can place any object with a rigidbody component attached to it inside and it will collide with the inner side of your sphere.
sphere with innerside to collide with

Just reverse Normals and use MeshCollider to fix problem.

Related

Set normal of particles from mesh

I have a particle effect that renders a bunch of billboard particles over the surface of a sphere mesh. The particles and the sphere have the same color and the same material.
It's everything ok, except for the fact that when my realtime light changes its direction, the sphere changes the color accordingly, but the particles don't. They change their colors, since the particles and the sphere use the same material, but the particle normals point to somewhere else, so they don't react to the light the same way the sphere does.
Is there a way I can set the normals for my particles correctly? That means: when instancing particles in some vertex of the surface of a mesh, how can I pass the normal of that vertex to the material of the particle (so that both the particle and the mesh vertex react to the light equally)?

Why Mesh Collider is not following 3D object's mesh exactly?

I am new to Unity and having trouble with 3D physics.
I imported a basic 3D "U" bar shape and applied Rigidbody and Mesh Collider. When I drop another object let's say a ball, it does not go into the shape. When I select the shape, I realized a green line between to edges of the U shape which seems like Unity recognizes it as rectangular object.
How I can make Mesh Collider the follow imported mesh's exact shape?
Thank you.
Shape:
Properties:
Mesh Collider:
Your shape is not convex so if you check the convex option then Unity3d will modify collision shape to be convex. mesh collider not matching shape
To fix that, try to uncheck the convex option.

Unity3D: Contrain movement to one axis at a time

I am making an isometric game in Unity. Im using a 3d cube as an agent for my 2d sprite. I have set up animations so that the sprite turn in the direction it is walking, however the cube is not walking in one axis at a time. Instead the cube moves in both the x and z axis, this messes up my animations. How am i suppose to contrain the cube to only walk one axis at a time so that the animations turn out correctly.
If your cube has a Rigidbody attached, you can check the axis you want to freeze under Rigidbody > Constraints > Freeze Rotation.

Unity 2D polygon collider

Is there a way to create 2D polygon collider to work as as perimeter collider?
I want to be inside the polygon and do a raycast to the border. I want the hitpoint to be on the border, not on the location where I am.
Can I use 2D polygon collider for that or do I need to use some other collider?
You could create a polygon shape with 2D Edge Colliders. Just calculate the different spots with the polygon's angles.
I noticed there was an answer saying this already. My bad. :)

How can i add right collider for a cylinder with hold inside?

I have a cylinder with a hole inside.
I did the cylinder in blender and exported it to unity.
The problem is that the character walk through the cylinder and i want the character to walk inside but not through.
So i added a capsule collider component to the cylinder.
Now when the character walk in there like a floor since i changed the collider Center on Y to -1.5 and the Radius to 2 and the Height to 4.
The problem is if i will change the collider to be higher then the character will not be able to walk in the hole.
The collider component on the cyolinder settings in the inspector:
Either you put a meshcollider , or a mix of sphere and box colliders.