Petey
1
Godot Version
v4.4.1.stable
Question
Hi all,
Just wondering, how you would go about getting the collision mesh from a raycast collision? I’d like to use it in the mesh data tool.
The RayCast is hitting the StaticBody3D from this model fine.
But I can’t find a way to get the ArrayMesh from the collider to send to the MeshDataTool.
Is there a way to do that?
Thanks,
Pete
mrcdk
2
1 Like
Petey
3
Hey thanks!
I just tried this -
ArrayMesh arrayMesh = collisionShape3D.Shape.GetDebugMesh();
meshDataTool.CreateFromSurface(arrayMesh, 0);
But I’m getting this error sadly 
surface_get_primitive_type(p_surface) != Mesh::PRIMITIVE_TRIANGLES" is true. Returning: ERR_INVALID_PARAMETER
This prints “Lines”. Maybe the debug collision mesh is stored as something other than a normal mesh.
GD.Print(arrayMesh.SurfaceGetPrimitiveType(0));