- Home /
How can I create a 3d mesh using raycasts?
Hi,
I've been experimenting with raycasts and currently have a sphere of raycasts being generated, I am wanting to join all of the hit points/max distances (basically where each ray ends) to create a 3d mesh. So if none of the rays hit anything then it would just be a sphere.
Any help appreciated as I am really stuck with this.
Thanks, Scott
There's a class on the Unity wiki that might be helpful: Triangulator.
edit: Looks like that's for 2D, but you can modify it for 3D pretty easily.
The issue I'm having is converting algorithms to 3d from 2d. I found this article really useful (https://www.linkedin.com/pulse/using-raycasts-dynamically-generated-geometry-create-line-thomas/) but when I converted it to 3d the framerate was non-existent and I struggled to create a mesh of just the hit points rather than the ray start and end points.
Your answer
![](https://koobas.hobune.stream/wayback/20220612215151im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How does the Triangles work on Mesh? 1 Answer
Is there a similar Command to lineRenderer.SetVertexCount for mesh?? 0 Answers
How do i access the MeshExtrusion.cs from Unity's PE? 1 Answer
How do i have a Vector3[] position be in another Vector3[] position (That Updates)?? 1 Answer
How do i cast mesh like a linerenderer? 0 Answers