- Home /
Generate a highpoly sphere with mesh collider procedurally
How do you generate a highpoly sphere procedurally with a mesh collider that fits?
What do you mean? to create the sphere with higher poly in unity? Or you just want to create a sphere with high poly in blender (export it) and then just attach a mesh collider in Unity.?
How do you generate the sphere mesh procedurally using mesh loops
Answer by Bunny83 · Mar 16, 2011 at 04:17 AM
If it should be a perfect sphere you shouldn't use a meshcollider. Meshcolliders are slow and can't collider with other meshcolliders. Just use a SphereCollider.
To create a sphere mesh you can just use some trigonometry (sin / cos) to calculate the vertices. To setup the UVs take a look at the UV mapping article on wikipedia.
Maybe you can go a bit more in detail what you wanna do. If you want to create a planet surface then you would need a meshcollider. After you created your mesh, just assign it also to the meshcollider. That should be enough.
Exactly, the last thing you want to do is use a meshcollider when the shape is just a sphere. Especially since a sphere is the fastest collision primitive possible.
what if you want high poly - spherecollider has limited resolution iirc
What do you mean with limited? A sphere collider is infinite accurate as long as it's a sphere. If you want an irregular surface you would need a meshcollider. What does your "sphere" look like?
Answer by Noah-1 · Mar 16, 2011 at 04:10 AM
Hello.
If your mesh collider is smaller than your sphere you can atach the mesh collider to an empty gameObject then just scale it to the same size of the sphere and attach it.
Good Luck.
Your answer
Follow this Question
Related Questions
MeshCollider is not getting updated when adding vertex to mesh 1 Answer
Save previous state of mesh procedurally 1 Answer
AAPT Failed! 0 custom asset files in raw for Procedural Examples Paint Vertices to Android 2 Answers
Way to erase meshfilter mesh and rewrite it? 1 Answer
Copying the mesh, collider, and material of a procedurally generated GameObject 0 Answers