mcneel / rhino3dm

Libraries based on OpenNURBS with a RhinoCommon style
MIT License
582 stars 135 forks source link

Using Rhino.Compute in Unity for WebGL #449

Open pedrocortesark opened 2 years ago

pedrocortesark commented 2 years ago

Testing a possible workflow from Unity and compiling for WebGL

Project review

El proyecto tiene el objetivo de testear un posible workflow en el que Unity pueda compilar un proyecto que utilice Compute (en este ejemplo he utilizado un servidor local) para WebGL. Algunos usuarios lo han solicitado en Discourse:

https://discourse.mcneel.com/t/unity-webgl-build/105308

Workflow

The user executes a function on the Unity canvas (create MeshSphere) that communicates with the Unity directives to the Javascript code (rhino3dm.js), where it creates a simple sphere. This sphere is sent to compute to calculate the mesh and the resulting json is transferred to the Unity canvas.

Back in Unity, we need to make use of rhino3dm.net to deserialize the json and obtain the mesh to visualize.

Here you have a simple schema of this function:

UnityWebGL

Error

When trying to deserialize the json by using rhino3dm, I got the error: DllNotFoundException: Unable to load DLL 'librhino3dm_native'

I don't know if there is a workaround to solve this...