Mouse picking faces of a geosphere
First, a little about where I'm at:
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
var idx = 0;
PolygonIndices poly = dh.polygons.Where(
p => (idx += p.indices.Count) > hit.triangleIndex * 3
)
.FirstOrDefault();
selectedCell.Polygon = poly;
}
This is the only object in the scene that will have a collider, so poor performance of mesh colliders is not really an issue.
Does anybody have any ideas to allow rotating the object and having the mesh collider synchronize it's position? I've tried applying the object's transform to the collider, parenting the object to an empty node (rotating that node instead), and binding the collider to the rendered mesh (which is a disaster).
I'm also open to other solutions, if anyone knows any tricks I can use.
I did some refactoring and now the problem is non-existent. I would still like to know the cause of it, though.
What I changed: - Removed the $$anonymous$$eshRenderer component from the object with the $$anonymous$$eshCollider - Added geometry as child objects - Added an orbit camera script, targetted to the object.
Now, whenever I update the rotation of the object in the inspector, the $$anonymous$$eshCollider is also updating it's position. $$anonymous$$aybe this is related to the submeshes, or binding two meshes to the same object through different components.
Your answer
![](https://koobas.hobune.stream/wayback/20220612044923im_/https://answers.unity.com/themes/thub/images/avi.jpg)