- Home /
Invert sphere collider
I plan for the player walk from the inside of a sphere. I can't find out how to do it, and from what I've checked, other related topics don't have a clear answer on how to do this.
This is a sphere collider I'm trying to invert, so trying to make multiple planes to form the shape of a sphere won't do.
Not possible without access to the sourcecode of Unity. A sphere collider is nothing more than a test for the radius to a point. If less, then push out. That's it.
If you want to invert that you'd need to write your own special Physics for that case. Do not use a sphere collider but do the calculations necessary yourself and apply them in FixedUpdate.
This used to be possible with Convex mesh colliders but its not longer supported unless rigidbody is kinematic. I tried taking a slice out of a sphere and making it thick but Unity is no longer able to generate a matching mesh. This is actually disappointing as I had an old game that relied on it.
Answer by Bodhid · Mar 04, 2018 at 11:13 AM
That is unfortunately not possible with how a sphere collider works, it is a distance check to the center. The only thing you can do is have an actual mesh to walk on, or do everything by code yourself.
You can create a (high poly) sphere in 3D modelling software (maya, 3ds max, blender etc.) and reverse the faces. Then use it as an mesh collider (not convex) in your unity scene.
Answer by AyeEmTeeBee · Mar 04, 2018 at 07:35 PM
I've got the collider working from flipping a sphere in Blender, but the material is not showing. Using base color seems to work fine on it, but using textures does not work.
Check the UV's on your model. A sphere usually has an equirectangular texture layout. It could be that this was lost when you flipped the sphere
Answer by saml_baker · Mar 04, 2018 at 06:59 AM
One thing that I could think of is like what you said kind of is to create a plane and distort it into a sphere shape or using multiple planes. You also could create a mesh from parametric equations and then use the mesh as the collider for a mesh collider but you should not because it would be incredibly inefficient to do so.
Maybe you could make a flat plane that the Player stands on that is at the same level as the sphere floor instead of making a large collider for the entire sphere. Using this method, if it is a first person game, you could make the plane and player stationary while the sphere moves around them when the player presses the keys? If it is 3rd person you could make the plane match the position of the player and match the rotation of the sphere? I am not entirely sure but those are my thoughts.
I'm not ai$$anonymous$$g for an anti-gravity effect. Gravity should always pull the player down, like trying to run up a bowl. Should I create a mesh in Blender to be used as the collider and a renderer?
yes I think that for the affect you are looking for, that is your best option.
Answer by SibochCZ · Sep 04, 2020 at 06:27 PM
I did it by giving a collider object thickness in Blender. In my case I wanted to create cylindrical collider to collide with objects inside. Just beware of normals, they must be flipped towards the object(s) you want to collide with.
Your answer
![](https://koobas.hobune.stream/wayback/20220612153914im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Find out needed sphere radius to cover a collider 1 Answer
How to keep the orientation of an object unchanged when applying forces on its sphere collider? 1 Answer
CharacterController vs Rigidbody (photo included) 2 Answers
pop up between 2 colliders: bug or not? 1 Answer
How can I disable this collider, when two are present on the gameobject 1 Answer