zaphara Working on this I realized our artists have switched pretty much all of our meshes to multiple surfaces with different albedo colors instead of using textures (makes it much easier for me).

So using the forum post above - I was able to get it all working fairly easily - I can scan the surfaces, find which one has a face matching the collision point, and read off the color.

In that case it may be better to copy mesh data into colliders and let the engine do the rest.

    xyz I call create_trimesh_collision() to get the corresponding collision for my visual mesh.

    When I call intersect_ray I get result.shape which tells me which MeshInstance I hit. But then I have to use the MeshTool to figure out the surface and face.

    Is there any way to directly get the surface index from the intersect_ray call? This would be very useful.
    Also is there any way to directly get the face index?

    I have assumed this is not available directly.

    Many thanks for your help.

    • xyz replied to this.

      zaphara You can make a separate collider for each surface. Surface identification will then be implicit. But I don't think the engine can get you the triangle.

        xyz Thanks - this could be an interesting approach. Would definitely make the calculation trivial. I'll need to look into exactly how I would separate the surfaces.

        • xyz replied to this.

          zaphara I'll need to look into exactly how I would separate the surfaces.

          Query the mesh using Mesh::surface_get_arrays() and use returned data to build convex mesh colliders.

            xyz Thanks - performance is adequate for the moment so I will improve this probably in a few weeks. But these are all great suggestions.