blog games developers documentation portfolio gallery

Documentation:

Import()

The ObjImporter.cs contains 2 overloaded functions to import your .OBJ model:

GameObject Import(string objString)


This reads the string and creates a GameObject (possibly with children) that has a MeshRenderer and a MeshFilter component added to it.

To obtain the mesh itself, you can access the MeshFilter component.

MeshFilter meshFilter = go.GetComponent();
Mesh mesh = meshFilter.mesh;


GameObject Import(string objString, Quaternion rotate, Vector3 scale, Vector3 translate)


The string is imported and the vertices of the meshes are first rotated by "rotate", then scaled by "scale" and finally translated by "translate".
This is useful when the model does not have the Y-axis up (rotate x 270 degrees usually does the trick), or uses a different unit (centimeters, inches instead of meters). Or sometimes the center of the model (0,0,0) lies somewhere outside the model.







follow us